Linked List
A Linked List is a linear collection of nodes
Last updated
Was this helpful?
A Linked List is a linear collection of nodes
Last updated
Was this helpful?
A Linked List is a sequential collection of nodes. nodes = elements
The first item must be accessed, then the second, and finally the third now can be accessed.
Pointers! The first item in the list points to the next item in the list, the second item in the list points to the third, etc, etc. Each item in the linked list has two different pieces of information:
Life: Birth -> Child -> Teen -> Adult -> Old -> Death
Chain of command: employee <-> local manager <-> regional Manager <-> CEO
Monopoly board game: the access to properties on an never ending circle, rentee torture
A Linked List is arranged in such a way that in order to obtain an item in the list, it must be accessed in order from start to finish. for example, the third itemis wanted.
In the above picture inorder for Mario to get to Donkey Kong he must travel linearly (level by level) up the ladders.
Where is the next item at? (pointer)
Stored data (value)
Singly-Linked-List: The access to the list is forward.
Doubly-Linked-List: The access to the list is forward or backwards.
Circular-Linked-List: The access to the list is forward and infinite. The list eventually meets up with itself, creating a loop.