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