Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Structures and data algorithms / Project / exa / SkipList.hpp
diff options
context:
space:
mode:
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;
}