Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename TKey, typename TValue>
- class avltree{
- private:
- // called by both clear() and ~avltree() to clear avl tree.
- _clearMemory(){
- }
- public:
- // constructors:
- // default
- avltree(){
- }
- // copy constructor
- avltree(avltree& other){
- }
- int size(){
- }
- int height(){
- }
- // empties tree
- void clear(){
- _clearMemory();
- // TODO: When clear returns, the root should be nullptr and the size 0
- }
- TValue* search(TKey key){
- }
- void insert(){
- }
- /*
- returns path length between 2 keys
- (the length of the minimum path)
- */
- int distance(TKey k1, TKey k2){ // distance
- //int distance = -1;
- if k1 or k2 does not exist in the tree
- return -1
- else if(k1 == k2)
- return 0;
- }
- void inorder(){
- }
- std::vector<TKey> inorder_keys(){
- }
- std::vector<TValue> inorder_values(){
- }
- std::vector<int> inorder_heights(){
- }
- //destructor - TODO: checked using valgrind (week 5 labs)
- virtual ~avltree(){
- _clearMemory();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement