Sunday, 17 April 2016

Doubly Linked List implementation in Java

In this blog post we will see  how to implement LinkedList in java,  first we have to understand how Linked List differs from ArrayList  , This is how Array List is stored in memory




but Link List just has a reference to the next node ,  in the case of doubly Linked a Node has pointer to both previous element and the next element , if the node previous Node is null then it is the head node , if its next node is null then it is the tail or Last element 



Lets see the implementation and  the Test cases 



















as you can see the implementation is straight forward , nothing complex the entire code and Test cases can be found in the following repo