Linked List
A Linked List is a linear collection of nodes
What is a Linked List? âī¸
A Linked List is a sequential collection of nodes. nodes = elements
Level Progression đšī¸
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 itemđ¤Ąis wanted.
đž đ đ¤ đ đ¤Ą
The first item must be accessed, then the second, and finally the third now can be accessed.
đšī¸ In the above picture inorder for Mario to get to Donkey Kong he must travel linearly (level by level) up the ladders.đšī¸
How It Works đ đ đ
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:
Where is the next item at? (pointer)đ
Stored data (value) đž
Flavors of Linked Lists đ¨
Singly-Linked-List: The access to the list is forward. đ
Life: Birth -> Child -> Teen -> Adult -> Old -> Death
Doubly-Linked-List: The access to the list is forward or backwards.đ đ
Chain of command: employee <-> local manager <-> regional Manager <-> CEO
Circular-Linked-List: The access to the list is forward and infinite. The list eventually meets up with itself, creating a loop. đđĄ
Monopoly board game: the access to properties on an never ending circle, rentee torture
Last updated