Singly Linked List vs Doubly Linked List
Before looking at the differences between the singly linked list and doubly linked list,
we first understand what is singly linked list and doubly linked list separately.
What is a singly linked list?
A singly linked list can be simply called a linked list. A singly linked list is a list that
consists of a collection of nodes, and each node has two parts; one part is the data
part, and another part is the address. The singly linked can also be called a chain as
each node refers to another node through its address part. We can perform various
operations on a singly linked list like insertion, deletion, and traversing.
What is a doubly-linked list?
A doubly linked list is another type of the linked list. It is called a doubly linked list
because it contains two addresses while a singly linked list contains a single address.
It is a list that has total three parts, one is a data part, and others two are the pointers,
i.e., previous and next. The previous pointer holds the address of the previous node,
and the next pointer holds the address of the next node. Therefore, we can say that
list has two references, i.e., forward and backward reference to traverse in either
direction.
Before looking at the differences between the singly linked list and doubly linked list,
we first understand what is singly linked list and doubly linked list separately.
What is a singly linked list?
A singly linked list can be simply called a linked list. A singly linked list is a list that
consists of a collection of nodes, and each node has two parts; one part is the data
part, and another part is the address. The singly linked can also be called a chain as
each node refers to another node through its address part. We can perform various
operations on a singly linked list like insertion, deletion, and traversing.
What is a doubly-linked list?
A doubly linked list is another type of the linked list. It is called a doubly linked list
because it contains two addresses while a singly linked list contains a single address.
It is a list that has total three parts, one is a data part, and others two are the pointers,
i.e., previous and next. The previous pointer holds the address of the previous node,
and the next pointer holds the address of the next node. Therefore, we can say that
list has two references, i.e., forward and backward reference to traverse in either
direction.