Skip to content

RatulDawar/skip-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Skip List Data Structure Implementation in C++

Overview

This project implements a Skip List data structure in C++, providing an efficient alternative to balanced trees for implementing associative arrays. Skip lists are probabilistic data structures that offer logarithmic time complexity for search, insertion, and deletion operations, making them suitable for various applications where fast access to sorted data is required.

Concept

Skip lists consist of multiple linked lists, each with nodes containing references to nodes in lower levels. By "skipping" ahead in multiple linked lists, skip lists provide faster search operations compared to traditional linked lists. Every element has a 1/2 probability to get promoted to the next level. The total number of levels are asymptotic to log n.

Performance

  • Time Complexity: Average case
    • Search: O(log n)
    • Insertion: O(log n)
    • Deletion: O(log n)
  • Space Complexity: O(n)

Usage

Skiplist* obj = new Skiplist();
bool param_1 = obj->search(target);
obj->add(num);
bool param_3 = obj->erase(num);

Repository

Feel free to explore the repository and use the Skip List implementation in your projects!

About

A memory efficient implementation of skip list data structure in C++.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages