Problem statement
Design the object model and public API for a skip list — a probabilistic ordered map that supports search, insert, and delete in expected O(log n) without the rotations a balanced tree needs.
Operating context. One process, in-memory ordered dictionary keyed by a comparable key with an associated value; keys are unique. Node levels are grown by a randomized generator (repeated coin flips / a geometric draw), capped at a maximum level. A probability factor and the level cap are construction parameters. This is the ordered index behind an in-memory store: reads dominate, but writes interleave.
Out of scope. Persistence or a write-ahead log, concurrent lock-free skip lists (name the locking seam only), duplicate keys, range-delete compaction, and any memory-mapped or off-heap node layout.
What to produce. The node structure (key, value, and a forward-pointer array indexed by level), the SkipList class and its public API (get, put, remove, floor, ceiling, range scan, size), the randomized level-generation strategy, and the update-vector bookkeeping that relinks forward pointers across every affected level on insert and delete — state the sorted-sublist invariant explicitly.
Requirements
This assessment is a Premium feature.
The statement above is free to read. The functional and non-functional requirements, and the graded canvas that scores your design against them, come with Premium.
Topics
- System Design LLD
- Ds Skip-List
- Algo Probabilistic
- Oop Solid
- Patterns Strategy