Interactive Skip List

92 views

Posted: 01 Mar 2022 (15:08)
Last Edited: 26 Mar 2022 (13:15)

Salil M.

@cmd05

...

C++ implementation of a Skip List, with an interactive console

tbbvzdbvpcqnznt1rnec.png


A skip list is a probabilistic data structure. The skip list is used to store a sorted list of elements or data with a linked list. It allows the process of the elements or data to view efficiently. In one single step, it skips several elements of the entire list, which is why it is known as a skip list.


-INF <-----------------------------------------------------> 75.000000 <----> INF
-INF <-----------------------------------------------------> 75.000000 <----> INF
-INF <-------------------> 1.000000 <----------------------> 75.000000 <----> INF
-INF <-------------------> 1.000000 <-----> 10.000000 <----> 75.000000 <----> INF
-INF <--> -100.000000 <--> 1.000000 <-----> 10.000000 <----> 75.000000 <----> INF


Demo

r64jsistbodpcnbg8xgh.gif


Files

Console.cpp
Console.h
Linked_List.cpp
Linked_List.h
Skip_List.cpp
Skip_List.h
main.cpp
output.txt


Example

std::vector<double> v = {90, 15, -59, 48, -1, -28};
Skip_List skip_list{v};

/// Operations
skip_list.insert(5);
skip_list.remove(90);
Node* node = skip_list.search(-1);
skip_list.remove(5);

/// Console
Console console{skip_list, "output.txt"};
console.write_to_file("output.txt");
console.run();






Tags


cpp code structures data programming

Comments





Salil M. 05 Apr 2022 (13:34)

0.05071045891719583

REPLY


Salil M. 05 Apr 2022 (13:34)

0.29027067307235477

REPLY


Salil M. 05 Apr 2022 (13:34)

0.4374205729388936

REPLY


Salil M. 05 Apr 2022 (13:34)

0.9771424282399448

REPLY


Salil M. 05 Apr 2022 (13:34)

0.11735157102892635

REPLY


Salil M. 05 Apr 2022 (13:34)

0.33153657075669796

REPLY


Salil M. 05 Apr 2022 (13:34)

0.28011595278773305

REPLY


Salil M. 05 Apr 2022 (13:34)

0.040607537887584755

REPLY


Salil M. 05 Apr 2022 (13:34)

0.9776889594558842

REPLY


Salil M. 05 Apr 2022 (13:34)

0.3197631689175704

REPLY