diff options
[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.hpp | 9 |
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; } |
