Like array and linked list, unrolled Linked List is also a linear data structure and is a variant of linked list. Unlike simple linked list, it stores multiple elements at each node. That is, instead of storing single element at a node, unrolled linked lists store an array of elements at a node. Unrolled linked list covers advantages of both array and linked list as it reduces the memory overhead in comparison to simple linked lists by storing multiple elements at each node and it also has the advantage of fast insertion and deletion as that of a linked list.
- Because of the Cache behavior, linear search is much faster in unrolled linked lists.
- In comparison to ordinary linked list, it requires less storage space for pointers/references.
- It performs operations like insertion, deletion and traversal more quickly than ordinary linked lists (because search is faster).
- The overhead per node is comparatively high than singly linked lists. Refer an example node in below code.
Simple Implementation in C
The below program creates a simple unrolled linked list with 3 nodes containing variable number of elements in each. It also traverses the created list.
1 2 3 4 5 6 7 8 9
In this article, we have introduced unrolled list and advantages of it. We have also shown how to traverse the list. In the next article, we will be discussing insertion, deletion and values of maxElements/numElements in detail.
This article is contributed by Harsh Agarwal. 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 write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Segment Tree | Set 1 (Sum of given range)
- Find pairs with given sum in doubly linked list
- Convert a Binary Tree to a Circular Doubly Link List
- Subtract Two Numbers represented as Linked Lists
- Skip List | Set 1 (Introduction)
- C++ Program to implement Symbol Table
- Iterative Preorder Traversal of an N-ary Tree
- Flatten a binary tree into linked list | Set-2
- Iterative Segment Tree (Range Maximum Query with Node Update)
- Print the DFS traversal step-wise (Backtracking also)