You are on page 1of 3

Singly linked list vs Doubly linked list 

Singly linked list (SLL) Doubly linked list (DLL)  

SLL nodes contains 2 field -data field DLL nodes contains 3 fields -data field, a
and next link field. previous link field and a next link field.  

In DLL, the traversal can be done using the


In SLL, the traversal can be done using previous node link or the next node link. Thus
the next node link only. Thus traversal traversal is possible in both directions (forward
is possible in one direction only. and backward).  

The SLL occupies less memory than The DLL occupies more memory than SLL as
DLL as it has only 2 fields. it has 3 fields.  

Complexity of insertion and deletion at a given


Complexity of insertion and deletion at position is O(n / 2) = O(n) because traversal
a given position is O(n).  can be made from start or from the end.  

Complexity of deletion with a given


node is O(n), because the previous Complexity of deletion with a given node is
node needs to be known, and traversal O(1) because the previous node can be
takes O(n) accessed easily  
Singly linked list (SLL) Doubly linked list (DLL)  

We mostly prefer to use singly linked We can use a doubly linked list to execute
list for the execution of stacks. heaps and stacks, binary trees.  

When we do not need to perform any


searching operation and we want to
save memory, we prefer a singly linked In case of better implementation, while
list. searching, we prefer to use doubly linked list.  

A singly linked list consumes less


memory as compared to the doubly The doubly linked list consumes more memory
linked list. as compared to the singly linked list.  

S. Singly linked list Doubly linked list


No.

1 In case of singly linked lists, the complexity of In case of doubly linked lists, the complexity
insertion and deletion is O(n) of insertion and deletion is O(1)

2 The Singly linked list has two segments: data The doubly linked list has three segments.
and link. First is data and second, third are the pointers.

3 It permits traversal components only in one It permits two way traversal.


way.

4 We mostly prefer a singly linked list for the We can use a doubly linked list to execute
execution of stacks. binary trees, heaps and stacks.

5 When we want to save memory and do not need In case of better implementation, while
to perform searching, we prefer a singly linked searching, we prefer a doubly linked list.
list.
6 A singly linked list consumes less memory as The doubly linked list consumes more
compared to the doubly linked list. memory as compared to the singly linked list.

You might also like