## DATA STRUCTURES

4 stars based on 46 reviews

In computer programming, an unrolled linked list is a variation on the linked list which stores multiple elements in each node. It can dramatically increase cache performance, linked lists and binary trees decreasing the memory overhead associated with storing list metadata such as references.

It is related to the B-tree. Each node holds up to a certain maximum number of elements, typically just large enough so that the node fills a single cache line or a small multiple thereof. A position in the list is indicated by both a reference to the node and a position in the elements array. It linked lists and binary trees also possible to include a previous pointer for an unrolled doubly linked list. To insert a new element, we simply find the node the element should be in and insert the element into the elements array, incrementing numElements.

If the array is already full, we first insert a new node either preceding or following the current one and move half of the elements in the current node into it. To remove an element, linked lists and binary trees simply find the node it is in and delete it from the elements array, linked lists and binary trees numElements.

If this reduces the node to less than half-full, then we move elements from the next node to fill it back up above half. If this leaves the next node less than half full, then we move all its remaining elements into the current node, then bypass and delete it. One of the primary benefits of unrolled linked lists is decreased storage requirements. All nodes except at most one are at least half-full. If many random inserts and deletes are done, the average node will be about three-quarters full, and if inserts and deletes are only linked lists and binary trees at the beginning and end, almost all nodes will be full.

Unrolled linked lists effectively spread the overhead v over a number of elements of the list. Thus, we see the most significant space gain when overhead is large, maxElements is large, or elements are small. If the elements are particularly small, such as bits, the overhead can be as much as 64 times larger than the data on many machines. Moreover, many popular memory allocators will keep a small amount of metadata for each node allocated, increasing the effective overhead v.

Both of these make unrolled linked lists more attractive. Additionally, if the size linked lists and binary trees each element is small compared to the cache line size, the list can be traversed in order with fewer cache misses than ordinary linked lists. In either case, operation time still increases linearly with the size of the list. From Wikipedia, the free encyclopedia. Binary decision diagram Directed acyclic graph Directed acyclic word graph.

List of data structures. Retrieved from " https: Views Read Edit View history. This page was last edited on 1 Aprilat By using this site, you agree to the Terms of Use and Privacy Policy.