kelvins / algorithms-and-data-structures

:abacus: Algorithms and Data Structures in several Programming Languages
MIT License
1.04k stars 256 forks source link

added skip lists #338

Closed MrWeast closed 9 months ago

MrWeast commented 9 months ago

added skip lists and a skip list implementation in python

Description

skip lists are another common data structure and adding it will also allow for more opportunities for others to contribute in different languages

skip_list.py

methods

code verification

the skip_list.py includes a main function which includes trying out different test cases such as inserting a new minimum value, trying to insert a duplicate, removing elements, causing a rebuild and so on.

It also includes inserting 50 arbitrary numbers, then removing 30 of them randomly, and then trying to remove 10 numbers that were never inserted at all.