Hey folks,
I am currently in the middle of The Ultimate Data Structures & Algorithms: Part 1 course, making my way through Hash Map topic.
In lesson 15 the ask is to write up code for HashMap using LinkedList where Entry represents object holding int + String. When putting together HashMap.put(int, String) method for new objects that should be stored under the same index in an array we were supposed to use chaining approach for collisions.
In his solution to the problem Mosh (pated below) is using addLast() method which works in sense its adding new Entry object at next slot of relevant index however there is no pointer between sequential items (2nd screenshot). When preparing my own solution I was using entry.next to keep pointers in place.
If there are no links between relevant items how is method keeping right order and adding new item to the back of the list? I can see that items are stored in non-sequential slots in memory which really makes me wonder how does it work under the hood.
Cheers!