Skip to content
Related Articles

Related Articles

Improve Article

Difference between Singly linked list and Doubly linked list

  • Difficulty Level : Easy
  • Last Updated : 11 Sep, 2021
Geek Week

Introduction to Singly linked list : A singly linked list is a set of nodes where each node has two fields ‘data’ and ‘link’. The ‘data’ field stores actual piece of information and ‘link’ field is used to point to next node. Basically the ‘link’ field stores the address of the next node.

 

linkedlist

Introduction to Doubly linked list : A Doubly Linked List (DLL) contains an extra pointer, typically called previous pointer, together with next pointer and data which are there in singly linked list. 

 



dll

Singly linked list vs Doubly linked list 
 

Singly linked list (SLL)Doubly linked list (DLL) 
SLL nodes contains 2 field -data field and next link field.DLL nodes contains 3 fields -data field, a previous link field and a next link field. 
linkedlistdll 
In SLL, the traversal can be done using the next node link only. Thus traversal is possible in one direction only.In DLL, the traversal can be done using the previous node link or the next node link. Thus traversal is possible in both directions (forward and backward). 
The SLL occupies less memory than DLL as it has only 2 fields.The DLL occupies more memory than SLL as it has 3 fields. 
Complexity of insertion and deletion at a given position is O(n). Complexity of insertion and deletion at a given position is O(1). 

 

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.  To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

In case you wish to attend live classes with experts, please refer DSA Live Classes for Working Professionals and Competitive Programming Live for Students.

My Personal Notes arrow_drop_up
Recommended Articles
Page :