Introduction to Skiplist
Explore the concept and structure of skiplists, a probabilistic data structure enabling efficient search, insert, and delete operations. Understand how random coin tosses determine node heights and create multiple linked lists to achieve average O(log n) performance on list and set operations. Gain insights into skiplist implementation and navigation techniques.
We'll cover the following...
Skiplist overview
Here, we discuss a beautiful data structure: the skiplist, which has a variety of applications. Using a skiplist we can implement a List that has time implementations of get(i), set(i, x), add(i, x), and remove(i). We can also implement an SSet in which all operations run in expected time.
The efficiency of skiplists relies on their use of randomization. When a new element is added to a skiplist, the skiplist uses random coin tosses to determine the height of the new element. The performance of skiplists is expressed in terms of expected running times and path lengths. This expectation is taken over the random coin tosses used by the skiplist. In the implementation, the random coin tosses used by a skiplist are simulated using a pseudo-random number (or bit) generator.
Skiplist structure
Conceptually, a skiplist is a sequence of singly-linked lists Each list contains a subset of the items in . We start with the input list that contains items and construct ...