0
62kviews
State differences between singly linked list and doubly linked list data structures along with their applications.
1 Answer
written 8.5 years ago by |
Singly linked list | Doubly linked list |
---|---|
A singly linked list is a linked list where the node contains some data and a pointer to the next node in the list | A doubly linked list is complex type of linked list where the node contains some data and a pointer to the next as well as the previous node in the list |
It allows traversal only in one way | It allows a two way traversal |
It uses less memory per node (single pointer) | It uses more memory per node(two pointers) |
Complexity of insertion and deletion at a known position is O(n) | Complexity of insertion and deletion at a known position is O(1) |
If we need to save memory and searching is not required, we use singly linked list | If we need better performance while searching and memory is not a limitation, we go for doubly linked list |
If we know that an element is located towards the end section, eg. ‘zebra’ still we need to begin from start and traverse the whole list | If we know that an element is located towards the end section e.g. ’zebra’ we can start searching from the Back. |
Singly linked list can mostly be used for stacks | They can be used to implement stacks, heaps, binary trees. |