The simplest form of linked lists — a singly linked list — is a series of nodes where each individual node contains both a value and a pointer to the next node in the list.
common operations you can perform on linked list:
Additions
add
: grow the list by adding items to the end of the list. Removalsremove
: will always remove from a given position in the list. Searchcontains
: will search the list for a value.
Doubly Linked List is a variation of Linked list in which navigation is possible in both ways, either forward and backward easily as compared to Single Linked List. Following are the important terms to understand the concept of doubly linked list.
-
Link − Each link of a linked list can store a data called an element.
-
Next − Each link of a linked list contains a link to the next link called Next.
-
Prev − Each link of a linked list contains a link to the previous link called Prev.
LinkedList − A Linked List contains the connection link to the first link called First and to the last link called Last.
common operations you can perform on linked list:
Additions
add
: grow the list by adding items to the end of the list. Removalsremove
: will always remove from a given position in the list. Searchcontains
: will search the list for a value. Displaydisplay
: displays the complete list in a forward manner.
Circular Linked List is a variation of Linked list in which the first element points to the last element and the last element points to the first element. Both Singly Linked List and Doubly Linked List can be made into a circular linked list.
Singly Linked List as Circular
In singly linked list, the next pointer of the last node points to the first node
Doubly Linked List as Circular
In doubly linked list, the next pointer of the last node points to the first node and the previous pointer of the first node points to the last node making the circular in both directions.
common operations you can perform on linked list:
Additions
add
: grow the list by adding items to the end of the list. Removalsremove
: will always remove from a given position in the list. Searchcontains
: will search the list for a value. Displaydisplay
: displays the complete list in a forward manner.
- Storing values in a hash table to prevent collisions