Hi folks,
During interview of BARC I was asked a very interesting question i.e. "Can we implement Doubly Linked List by using single pointer, How if yes?".
So here I am trying to explain you the concept of the implemetation of Doubly Linked List (Two Way Linked List) by using Single pointer.
Before going in to the concept we must understand what is Doubly or Two way Linked List.
A Doubly Linked List has following attributes:
During interview of BARC I was asked a very interesting question i.e. "Can we implement Doubly Linked List by using single pointer, How if yes?".
So here I am trying to explain you the concept of the implemetation of Doubly Linked List (Two Way Linked List) by using Single pointer.
Before going in to the concept we must understand what is Doubly or Two way Linked List.
A Doubly Linked List has following attributes:
- There are two pointers START & END, START contains the Address of 1st Node, and END Contains Address of Last Node.
- Each node of the list contains 2 pointer (NEXT, PREV) and 1 data part. NEXT contains the address of next node and PREV contains address of previous node.
- PREV of 1st node & NEXT of last node will contains null values.