Implementing hash table using Chaining through Doubly Linked List is similar to implementing Hashtable using Singly Linked List. The only difference is that every node of Linked List has the address of both, the next and the previous node. This will speed up the process of adding and removing elements from the list, hence the time complexity will be reduced drastically.
If we have a Singly linked list:1->2->3->4
If we are at 3 and there is a need to remove it, then 2 need to be linked with 4 and as from 3, 2 can’t be accessed as it is singly linked list. So, the list has to be traversed again i.e O(n), but if we have doubly linked list i.e.1<->2<->3<->4
2 & 4 can be accessed from 3, hence in O(1), 3 can be removed.
Below is the implementation of the above approach:
Value 5 was successfully added at key 4 Element found at key 4: 5 Element was successfully removed at the key 4
- Find count of common nodes in two Doubly Linked Lists
- Sorted merge of two sorted doubly circular linked lists
- Construct a Maximum Sum Linked List out of two Sorted Linked Lists having some Common nodes
- QuickSort on Doubly Linked List
- Reverse a Doubly Linked List
- Reverse a Doubly Linked List | Set-2
- XOR Linked List - A Memory Efficient Doubly Linked List | Set 1
- XOR Linked List – A Memory Efficient Doubly Linked List | Set 2
- Bubble Sort On Doubly Linked List
- Sort a k sorted doubly linked list
- Delete all the even nodes from a Doubly Linked List
- Sort the biotonic doubly linked list
- Merge Sort for Doubly Linked List
- Sort the biotonic doubly linked list | Set-2
- Delete all occurrences of a given key in a doubly linked list
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.