Randomized Finger Search Trees in Data Structure


Two randomized alternatives to deterministic search trees are the randomized binary search trees, treaps and the skip lists. Both treaps and skip lists are defined as elegant data structures, where the randomization facilitates simple and efficient update operations.

In this section we explain how both treaps and skip lists can be implemented as efficient finger search trees without changing the data structures. Both data structures support finger searches by consuming expected O(log d) time, where the expectations are taken over the random choices created by the algorithm during the construction of the data structure.

Skip lists

In a skip list, one can finger search for element a from a node containing the element b by simply continuing the search from this point. Note that if a < b, then search proceeds at backward direction, and if a > b, then search proceeds at forward direction. The backwards case is symmetric to normal search in a skip list, but the forward case is actually more complicated. Normally, search in a skip list is expected to be fast because the sentinel at the start of the list is considered as the tallest node. However, our finger could be associated with a node of height 1. Because of this, we may rarely climb while trying to search; something which never occurs normally. However, even with this complication, we can be able to achieve O(log d) expected search time.

Treaps

A treap is defined as a randomized binary search tree (BST). Searching in a treap is the similar as searching for an element in any other BST. Treaps however have the property that the expected path length between two elements of distanced is denoted as O(log d). Thus, to finger search from the node containing element b for element a, one can climb the tree from b element until an ancestor of element a is found, at which point normal BST search proceeds as usual manner. While calculating if a node is the ancestor of another is non-trivial, one may augment the tree to support queries of this form to provide expected O(log d) finger search time.

Updated on: 07-Jan-2020

80 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements