A linked list is a linear data structure where elements are not stored in contiguous memory locations.
None
, signifying the end of the list.
Unlike an array, you can’t access an element in a linked list by its index (e.g., list[3]
). To find an element, you must traverse the list from the head
node, following the next
pointers until you reach the desired node.
Think of a slideshow where each slide has a “Next” button to go to the following slide. You can only move one step at a time, from the current slide to the next.
This is very similar to a linked list: