Double Linked List
Double linked list is defined as when there are 2 pointers in a node, in which one pointer refers the address of next data item.
The terminology used in double linked list are
- head: It refers the address of first data item.
- last: It refers the address of last data item.
- prev: It stores the address of the previous data item.
- next: It stores the address of the next data item.
- data item: It stores the data in the memory.
- node: The combination of prev, next, and data item.
Unlike Single linked list ,double linked list can move either forward and backward direction.
Double linked list representation:
Insertion:
It inserts a node at the end of the double linked list. The address of last and last next are changed to the address of new node.
Deletion:
It deletes the last node from the double linked list. It changes the values of last and last but one node’s next .
Search :
It tries to search an element from the double linked list. using prev and next, the searching either moves forward and backward.
Traversal:
It displays all the elements stored in double linked list. it can either move from front to back or back to front.
Now let us see the programs of Double Linked list:
- C
2.Java
With this we will end Double Linked List concept.
My next story is about Circular Linked List.
Thank you.