https://github.com/christophkarlheck/skip-lists

https://github.com/christophkarlheck/skip-lists

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.8%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: ChristophKarlHeck
  • License: mit
  • Language: C++
  • Default Branch: main
  • Size: 317 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

Benchmarking Randomized SkipLists vs Deterministic SkipLists

bash mkdir -p build && cd build

bash cmake ..

bash make

bash ./SkipLists 1000 100 true

python python3 plot.py

Benchmark

SkipLists: A Randomized Search Data Structure

Why Use randomized SkipLists?

Deterministic search data structures, such as AVL trees, have predictable but sometimes inefficient behaviors regarding space and sophisticated rebalancing. Randomized SkipLists introduce probabilistic balancing, reducing insertion and deletion complexity while maintaining an efficient search performance.

Key Concepts

Deterministic SkipLists

  1. Structure: SkipLists maintain a hierarchy of linked lists, where each higher-level list "skips" over more elements.
  2. Search: Starts at the highest list and moves downward when an element more significant than the target is encountered.
  3. Worst-case search time: O(log n) due to the logarithmic number of lists.
  4. Insertion and Deletion: O(n) because of rearranging without sorting.

Randomized SkipLists

  1. Randomization Strategy:
    • Let the number of lists each element appears in be determined by a randomized process (fair coin flip).
  2. Expected Properties:
    • Height: O(log n) whp (with high probability).
    • Search Time: O(log n) expected, leveraging probabilistic balancing.
    • Insertion and Deletion: Each operation takes O(log n) whp due to the logarithmic height constraint.

Algorithm Details

Construction of Randomized SkipLists

  1. Sort elements and create the base list.
  2. For each element, flip a fair coin until it lands on heads; the number of tails determines the number of additional lists.
  3. Connect each list by the respective pointers The construction is a Monte Carlo Algorithm since failure if randomized SkipList is higher than log n, success otherwise. Therefore, we analyze E(H) and P(success).

Search Algorithm

  1. Start in the highest list.
  2. If the next element in the current list is >x, go one list down. Otherwise, go to that next element.
  3. Stop if the element was found or if it is stuck in list 0.

Insertion and Deletion

  • Insertion: Performed in O(log n) whp (with high probability) by inserting the new element into the appropriate lists based on the randomized level assignment.
  • Deletion: Performed in O(log n) whp by removing references to the element from all its lists. With high probability since the height of the list is in O(log n) whp.

Complexity Analysis

  • Expected height: O(log n).
  • Search time: O(log n), as constant amount of operations on every list --> c * log n
  • Insertion/Deletion: O(log n) due to the self-balancing nature of the structure. The data structure has the same properties as before Insertion/Deletion.

Owner

  • Login: ChristophKarlHeck
  • Kind: user

GitHub Events

Total
  • Public event: 1
  • Push event: 4
Last Year
  • Public event: 1
  • Push event: 4

Dependencies

requirements.txt pypi
  • contourpy ==1.3.1
  • cycler ==0.12.1
  • fonttools ==4.56.0
  • kiwisolver ==1.4.8
  • matplotlib ==3.10.0
  • numpy ==2.2.2
  • packaging ==24.2
  • pandas ==2.2.3
  • pillow ==11.1.0
  • pyparsing ==3.2.1
  • python-dateutil ==2.9.0.post0
  • pytz ==2025.1
  • six ==1.17.0
  • tzdata ==2025.1