The AVLTree class represents a templated linked-memory tree data structure.
More...
#include <avltree.h>
|
|
ostream * | _out |
| | member variable used for grading
|
| |
template<class K, class V>
class AVLTree< K, V >
The AVLTree class represents a templated linked-memory tree data structure.
template<class K , class V >
Assignment operator.
- Parameters
-
| rhs | The tree to make a copy of |
- Returns
- A reference to the current tree
template<class K , class V >
| void AVLTree< K, V >::insert |
( |
const K & |
key, |
|
|
const V & |
value |
|
) |
| |
Inserts into the AVLTree.
- Parameters
-
| key | The key to insert |
| value | The value for the key to insert |
template<class K , class V >
| V AVLTree< K, V >::find |
( |
const K & |
key | ) |
const |
Finds an element in the AVL tree.
- Parameters
-
| key | The element to search for |
- Returns
- the value stored for that key
template<class K , class V >
| void AVLTree< K, V >::print |
( |
ostream & |
out = cout | ) |
const |
Prints the AVLTree to a stream (default stdout).
- Parameters
-
| out | The stream to print to |
template<class K , class V >
| void AVLTree< K, V >::setOutput |
( |
ostream & |
newOut | ) |
|
This is a function used for grading.
- Parameters
-
| newOut | The stream to print to. |
template<class K , class V >
| void AVLTree< K, V >::insert |
( |
Node *& |
node, |
|
|
const K & |
key, |
|
|
const V & |
value |
|
) |
| |
|
private |
Private helper function for the public insert function.
- Parameters
-
| node | The current node in the recursion |
| key | The key to insert |
| value | The value for the key to insert |
template<class K , class V >
| V AVLTree< K, V >::find |
( |
Node * |
node, |
|
|
const K & |
key |
|
) |
| const |
|
private |
Finds an element in the AVL tree.
- Parameters
-
| node | The node to search from (current subroot) |
| key | The element to search for |
- Returns
- the value stored for that key
template<class K , class V >
A right left rotation.
This function should simply call rotateRight and rotateLeft.
template<class K , class V >
A left right rotation.
This function should simply call rotateLeft and rotateRight.
- Parameters
-
template<class K , class V >
| int AVLTree< K, V >::heightOrNeg1 |
( |
const Node * |
node | ) |
const |
|
private |
- Parameters
-
| node | The node's height to check |
- Returns
- the height of the node if it's non-NULL or -1 if it is NULL
template<class K , class V >
Helper function for operator= and cctor.
- Parameters
-
| subRoot | The current node in the recursion |
template<class K , class V >
Private helper function for clear that clears beneath the parameter node.
- Parameters
-
| subRoot | The current node in the recursion |
The documentation for this class was generated from the following files: