From ff64a5263e5ab4df3756d895de9af445b32ed243 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 26 Jan 2024 17:50:59 +0200 Subject: [PATCH] added skip list documentation --- tutorial/skip_list.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tutorial/skip_list.md diff --git a/tutorial/skip_list.md b/tutorial/skip_list.md new file mode 100644 index 00000000..5e60670d --- /dev/null +++ b/tutorial/skip_list.md @@ -0,0 +1,41 @@ +### Mini Tutorial for the Skip List class + + 1. skip_list -- creates a skip list with T type elements. + +### **insert**: +```cpp +#include + +skip_list 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 + +skip_list 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 + +skip_list 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'; +} + +``` \ No newline at end of file