![]() |
TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Public Member Functions | |
| SkipList () | |
| int | randomLevel () |
| void | insertElement (int key, void *value) |
| void | deleteElement (int key) |
| void * | searchElement (int key) |
| void | displayList () |
Private Attributes | |
| int | level |
| Maximum level of the skiplist. | |
| std::shared_ptr< Node > | header |
| Pointer to the header node. | |
SkipList class implementation with basic methods
Definition at line 55 of file skip_list.cpp.
|
inline |
Skip List constructor. Initializes header, start Node for searching in the list
Definition at line 64 of file skip_list.cpp.
|
inline |
Deletes an element by key and prints if has been removed successfully
| key | is number that is used for comparision. |
Definition at line 133 of file skip_list.cpp.
|
inline |
Display skip list level
Definition at line 191 of file skip_list.cpp.
|
inline |
Inserts elements with given key and value; It's level is computed by randomLevel() function.
| key | is number that is used for comparision |
| value | pointer to a value, that can be any type |
Definition at line 90 of file skip_list.cpp.
|
inline |
Returns random level of the skip list. Every higher level is 2 times less likely.
Definition at line 75 of file skip_list.cpp.
|
inline |
Searching element in skip list structure
| key | is number that is used for comparision |
Definition at line 170 of file skip_list.cpp.
|
private |
Pointer to the header node.
Definition at line 57 of file skip_list.cpp.
|
private |
Maximum level of the skiplist.
Definition at line 56 of file skip_list.cpp.