40 Lecture

CS301

Midterm & Final Term Short Notes

Skip List

Skip list is a probabilistic data structure that allows for efficient searching, insertion, and deletion operations on a set of elements. It is a linked list with multiple parallel layers, where each layer contains a subset of the elements from


Important Mcq's
Midterm & Finalterm Prepration
Past papers included

Download PDF
  1. Which of the following data structures is a probabilistic data structure? A) Binary search tree B) AVL tree C) Skip list D) Red-black tree Answer: C) Skip list

  2. In a skip list, what is the maximum number of levels that a node can have? A) 1 B) 2 C) log n D) Unlimited Answer: D) Unlimited

  3. What is the time complexity of searching for an element in a skip list? A) O(n) B) O(log n) C) O(n log n) D) O(1) Answer: B) O(log n)

  4. Which of the following operations cannot be performed on a skip list? A) Insertion B) Deletion C) Searching D) Sorting Answer: D) Sorting

  5. Which of the following is the main advantage of using skip lists over balanced trees? A) Space efficiency B) Time efficiency C) Ease of implementation D) None of the above Answer: C) Ease of implementation

  6. Which of the following is a disadvantage of using skip lists? A) High space complexity B) High time complexity C) Limited applicability D) None of the above Answer: A) High space complexity

  7. In a skip list, what is the probability of a node having k+1 levels, given that it has k levels? A) 1/2 B) 1/4 C) 1/8 D) 1/16 Answer: B) 1/4

  8. What is the worst-case time complexity of insertion in a skip list? A) O(n) B) O(log n) C) O(n log n) D) O(1) Answer: A) O(n)

  9. In a skip list, what is the maximum number of nodes that can be present in a level i, given that there are n total nodes in the skip list? A) n B) n/2 C) n/log n D) log n Answer: B) n/2

  10. Which of the following is a disadvantage of using skip lists over hash tables? A) Lower space complexity B) Higher time complexity C) Lack of support for efficient range queries D) None of the above Answer: C) Lack of support for efficient range queries



Subjective Short Notes
Midterm & Finalterm Prepration
Past papers included

Download PDF
  1. What is a skip list? Answer: A skip list is a probabilistic data structure that allows efficient searching, insertion, and deletion operations in a sorted sequence of elements.

  2. How does a skip list differ from a linked list? Answer: A skip list differs from a linked list in that it allows for logarithmic search time by adding layers of pointers to the underlying linked list.

  3. What is the time complexity of searching in a skip list? Answer: The time complexity of searching in a skip list is O(log n).

  4. What is the advantage of using a skip list over a binary search tree? Answer: The advantage of using a skip list over a binary search tree is that it requires less memory overhead and is simpler to implement.

  5. How is a skip list constructed? Answer: A skip list is constructed by layering multiple levels of nodes on top of a linked list, where each level skips over nodes in the lower levels with a certain probability.

  6. What is the maximum number of levels in a skip list? Answer: The maximum number of levels in a skip list is typically O(log n).

  7. How are nodes inserted into a skip list? Answer: Nodes are inserted into a skip list by first searching for the correct position in the lowest level, then flipping a coin to determine if the node should be promoted to a higher level.

  8. How are nodes removed from a skip list? Answer: Nodes are removed from a skip list by first searching for the node to be removed, then updating the pointers of the surrounding nodes to bypass the node to be removed.

  9. Can a skip list be used to implement a priority queue? Answer: Yes, a skip list can be used to implement a priority queue by maintaining the elements in sorted order.

  10. What is the space complexity of a skip list? Answer: The space complexity of a skip list is O(n log n).

A skip list is a probabilistic data structure that allows efficient searching, insertion, and deletion operations in a sorted sequence of elements. It is similar to a linked list, but with additional layers of pointers that enable fast search and insert operations. A skip list consists of a linked list of nodes, each of which contains a key-value pair and pointers to other nodes. The nodes in a skip list are organized into layers, with the lowest layer containing all the elements in sorted order. Each layer is constructed by selecting a subset of nodes from the layer below, where the selection of nodes is determined by a random process. Specifically, each node has a certain probability p of being included in the next layer, where p is typically 1/2 or 1/4. The advantage of using a skip list over a binary search tree is that it requires less memory overhead and is simpler to implement. In addition, a skip list can be faster than a binary search tree for some operations, especially in the case of large datasets. The time complexity of searching in a skip list is O(log n), where n is the number of elements in the list. This is because each layer has at most half the number of nodes as the layer below it, so the number of nodes to search decreases exponentially with each layer. Similarly, the time complexity of inserting and deleting elements from a skip list is also O(log n). Skip lists can be used to implement a variety of data structures, including sets, maps, and priority queues. In the case of a priority queue, the elements are maintained in sorted order, with the highest-priority element at the beginning of the list. The operations of inserting and deleting elements from the priority queue can be performed in O(log n) time. Overall, skip lists provide an efficient and flexible data structure for managing sorted lists of elements. They are easy to implement, require less memory than some other data structures, and provide good performance for many types of operations.