school/cs235/lab10/AVLInterface.h
2016-04-06 20:46:10 -07:00

60 lines
1.2 KiB
C++

//YOU MAY NOT MODIFY THIS DOCUMENT
#pragma once
#include "NodeInterface.h"
using namespace std;
class AVLInterface {
public:
AVLInterface() {}
virtual ~AVLInterface() {}
//Please note that the class that implements this interface must be made
//of objects which implement the NodeInterface
/*
* Returns the root node for this tree
*
* @return the root node for this tree.
*/
virtual NodeInterface * getRootNode() = 0;
/*
* Attempts to add the given int to the AVL tree
* Rebalances the tree if data is successfully added
*
* @return true if added
* @return false if unsuccessful (i.e. the int is already in tree)
*/
virtual bool add(int data) = 0;
/*
* Attempts to remove the given int from the AVL tree
* Rebalances the tree if data is successfully removed
*
* @return true if successfully removed
* @return false if remove is unsuccessful(i.e. the int is not in the tree)
*/
virtual bool remove(int data) = 0;
/*
* ROTATIONS:
* LEFT
*
* IDENTIFY NODES TO ROTATE
*
* ROT.RIGHT=CUR.LEFT
* CUR.LEFT=ROT
* CUR=ROT
*
*
*
*
* RIGHT
*
*
*
*/
};