Skip to content

Commit

Permalink
added skip list documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
spirosmaggioros committed Jan 26, 2024
1 parent 22d5814 commit ff64a52
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tutorial/skip_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
### Mini Tutorial for the Skip List class

1. skip_list<T> -- creates a skip list with T type elements.

### **insert**:
```cpp
#include <algoplus/list.h>

skip_list<int> s(3, 0.5);
s.insert(10); // inserts 10 to the list.
s.insert(5); // inserts 5 to the list.
s.insert(13); // inserts 13 to the list.
```
### **remove**:
```cpp
#include <algoplus/list.h>
skip_list<int> s(3, 0.5);
s.insert(10); // inserts 10 to the list.
s.insert(5); // inserts 5 to the list.
s.insert(13); // inserts 13 to the list.
s.remove(13); // removes 13 from the list.
```

### **search**:
```cpp
#include <algoplus/list.h>

skip_list<int> s(3, 0.5);
s.insert(10); // inserts 10 to the list.
s.insert(5); // inserts 5 to the list.
s.insert(13); // inserts 13 to the list.

// returns true if the key is in the list.
if(s.search(13)){
std::cout << "element 13 found in the list" << '\n';
}

```

0 comments on commit ff64a52

Please sign in to comment.