This is the first blog on linked lists that contains implementations in Java and introduces basic
operation such as add, get and delete. You can also read about problems and their solutions on linked lists
on LinkedList Common Problems and Solutions post.
Linked List is a sequence of data that are connected by links. Each list item is commonly referred as Node.
Every node stores certain data and a link to the next element. On the other hand, Linked lists can also have
two links (previous and next) to optimize some operations. They are called doubly linked lists.
Here is a simple illastration of singly linked lists.
and doubly linked list
Here is simple implementation of singly linked list in Java
You can add addFirst and getFirst, addLast and getLast methods by changing references of
head and tail respectively. They are easy and constant operations.
And here is implementaion of doubly linked list. Every node stores element data and two links: prev and next.
This is the first blog about linked lists, you can read LinkedList Advanced Operations blog for
recursion, reversing and some other operation imlementations.