Introduction
Lists are sequence containers that allow non-contiguous memory allocation using nodes. As compared to vector, the list has slow traversal, but once a position has been found, insertion and deletion are quick.
Advantages
- Overflow can never occur unless the memory is actually full.
- Compared to vector, insertions and deletions are quick.
- With large records, moving pointers is easier and faster than moving the items themselves.
Disadvantages
- The pointers require extra space.
- Do not allow random access.
- Slow traversal.
Types
There are four key types of linked lists:
- Singly Linked Lists
- Doubly Linked Lists
- Circular Linked Lists
- Circular Doubly Linked Lists