A data structure that contains a head, tail and length property.
Linked Lists consist of nodes, and each node has a value and a pointer to another node or null
null
next
next
next
4
6
8
2
HEAD
TAIL
LENGTH = 4
Lists
Arrays
Adding a new node to the end of the Linked List!
Removing a node from the end of the Linked List!
Removing a new node from the beginning of the Linked List!
Adding a new node to the beginning of the Linked List!
Retrieving a node by it's position in the Linked List!
Changing the value of a node based on it's position in the Linked List
Adding a node to the Linked List at a specific position
Removing a node from the Linked List at a specific position
Reversing the Linked List
in place!
13
27
32
71
HEAD
TAIL
13
27
32
71
TAIL
HEAD
REVERSING A SINGLY LINKED LIST
Insertion - O(1)
Removal - It depends.... O(1) or O(N)
Searching - O(N)
Access - O(N)