This is a basic type of Linked List.
| Singly | Doubly | Circular | |
|---|---|---|---|
| Concept | One way direction | Two way direction | One way direction in a circle | 
| Has head | Yes | Yes | No-because tail will refer to first node | 
| Has tail | Yes | Yes | Yes | 
| No of Node | 1-next node | 2-next node & previous node | 1-next node | 
| insert() | O(n) | O(1) | O(n) | 
| delete() | O(n) | O(1) | O(1) | 
| Benefit | require small space for each element | allow to traverse the list in both directions | execute to the end can be quickly | 
Reference :
No comments:
Post a Comment