Advertisement
varden

skiplist header

Feb 11th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #pragma once
  2. #include "SkipNode.h"
  3.  
  4. template <class Key, class Obj>
  5. class SkipList
  6. {
  7. public:
  8.     SkipList(float probability, int maxHeight, Key* maxKey);
  9.     virtual ~SkipList();
  10.  
  11.     bool insert(Key*, Obj*);
  12.     bool remove(Key*);
  13.     Obj* retrieve(Key*);
  14.  
  15.     class iterator
  16.     {
  17.     public:
  18.         iterator(SkipNode<Key, Obj>*);
  19.         iterator operator++();
  20.  
  21.     private:
  22.         SkipNode<Key, Obj>* cur;
  23.     };
  24.  
  25.     iterator begin();
  26.     iterator end();
  27.  
  28. private:
  29.     SkipNode<Key, Obj>* head;
  30.     SkipNode<Key, Obj>* tail;
  31.     float probability;
  32.     int maxHeight;
  33.     int curHeight;
  34.     int generateHeight();
  35. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement