Singly Linked List vs. Doubly Linked List

Difference Between Singly Linked List and Doubly Linked List Linked list is a linear data structure which is…

Difference Between Singly Linked List and Doubly Linked List

Linked list is a linear data structure which is used for storing a set of information or data. A linked list assigns memory to its components independently in its own chunk of memory and the on the whole the configuration is acquired by connecting these components just like the links in a series.

A singly linked list is constituted of series of nodes and each of these nodes has a link to the following node in the series. A doubly linked list has a succession of nodes where every node has link to the following node as along with the link with the previous node.

Singly Linked List

Every block in a singly linked list has two fields, the data field and the next field. The data field contains the real data stored up and next field contains the link to the following or next block in the series. The first block in the list is saved as the head of linked list.

Doubly Linked List

Every block in a doubly linked list has 3 fields. Just like singly linked list, data field contains the real data stored up and next field contains the link to the following or next block in the series. It has a third block namely ‘previous’ block’ which contains link to the previous block in the series. The first block or element of linked list is saved as the head of linked list. Doubly linked list can be easily moved across by following the next link in every block and in the same way moved across backwards by using the previous link in every block.

Singly Linked List vs. Doubly Linked List

  • Elements in singly linked list are linked to only the next element in the series while elements are linked with previous and next both elements in doubly linked list.
  • Singly linked lists need lesser space while doubly linked list need more space for every block in the list.
  • Basic functions like addition or deletion are complicated in doubly linked list because there are two links to deal with but you can easily manipulate the data because you can cross over the list and move back and forth in the list.

 

 

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts