About Singly & Doubly linked List
What is Linked List ?
<aside>
<img src="/icons/verified_gray.svg" alt="/icons/verified_gray.svg" width="40px" />
A linked list is a sequential list of nodes that hold data which point to other nodes also containing data
</aside>
- Data ⇒ Data ⇒ Data ⇒ Data ⇒ Null
Where are linked list used ?
- Use in many List, Queue & Stack implementation .
- Great for creating circular lists .
- Can easily model real world objects such as trains .
- Use in separate chaining, which is present certain Hashtable implementations to deal with hashing collision .
- Often used in the implementation of adjacency lists for graphs .
Terminology
- Head : The first node in a linked list .
- Tail : the last node a linked list .
- Pointers : Reference to another node .
- Node : An object containing data pointer(s) .
Singly Vs Doubly Linked List
Singly List
- only hold a reference to the next node. In the implementation you always maintain a reference to the Head to the linked list and a reference to the Tail node for quick additions / removals.
<aside>
<img src="/icons/square-alternate_gray.svg" alt="/icons/square-alternate_gray.svg" width="40px" />
3 ⇒ 84 ⇒ 85 ⇒ 21 ⇒ 90 ⇒ 29 ⇒ 44 ⇒ 30
</aside>