Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Structures and data algorithms / Project / exa / SkipList.hpp
diff options
context:
space:
mode:
Commitb6e654657da058e9a438ec4583fac8028758dfb4 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-12-29 09:09:41 +0200
Committer
 Syndamia <kamen@syndamia.com>
2022-12-29 09:09:41 +0200
Filesc23fd470e2c94e7acd2123676eed3fb5e4645769 /Year 2/Structures and data algorithms/Project/exa/SkipList.hpp
uni-projects-b6e654657da058e9a438ec4583fac8028758dfb4.tar
uni-projects-b6e654657da058e9a438ec4583fac8028758dfb4.tar.gz
uni-projects-b6e654657da058e9a438ec4583fac8028758dfb4.zip
Parentb6a3bfe4691089112d25870fbb9bcc83c67f9d26 (diff)
[SDP/P/exa] Removed hard coded example and added user input reading
1 files changed, 9 insertions, 0 deletions
-rw-r--r--Year 2/Structures and data algorithms/Project/exa/SkipList.hpp9
diff --git a/Year 2/Structures and data algorithms/Project/exa/SkipList.hpp b/Year 2/Structures and data algorithms/Project/exa/SkipList.hpp
index 125013b..4821aef 100644
--- a/Year 2/Structures and data algorithms/Project/exa/SkipList.hpp
+++ b/Year 2/Structures and data algorithms/Project/exa/SkipList.hpp
@@ -32,6 +32,7 @@ public:
bool addSkip(const T&, const T&);
T pop();
T& front();
+ T& back();
unsigned size();
bool empty();
@@ -176,6 +177,14 @@ T& SkipList<T>::front() {
}
template <class T>
+T& SkipList<T>::back() {
+ if (empty())
+ throw "Back called on empty SkipList!";
+
+ return tail->value;
+}
+
+template <class T>
unsigned SkipList<T>::size() {
return listSize;
}