#include <AVLTree.h>
Inheritance diagram for AVLTree< Data, ConfigData >:
Public Member Functions | |
AVLTree (ACompareNodesAlgorithm< Data, ConfigData > *Compare, DeleteTreeDataEnum DeleteTreeData=NO_DELETE_TREE_ITEM, ConfigData *pConfigData=NULL) | |
Constructor. | |
virtual | ~AVLTree () |
Destructor. | |
virtual Data * | Search (Data *NodeData, bool *NodeInserted) |
Find a data item. If not found, insert it. | |
virtual Data * | Find (Data *NodeData) |
Find a data item. If not found, return NULL. | |
virtual void | DeleteTree () |
This tree can't destory itself with a destructor, use this function instead. | |
Data * | Delete (Data *NodeData) |
Delete a node from the tree. | |
Data * | DeleteRoot () |
Delete the root node of the tree. | |
Protected Member Functions | |
Data * | Insert (AVLTree< Data, ConfigData > *Tree, Data *NodeData, bool &HasTreeGrown) |
Recursively search for the correct place for a node and insert it. | |
Data * | Find (AVLTree< Data, ConfigData > *Tree, Data *NodeData) |
Recursively search for data on an AVLTree. | |
AVLNode< Data > * | Remove (AVLTree< Data, ConfigData > *Tree, Data *NodeData, bool &HasTreeShrunk) |
Recursively search for a node and delete it. | |
AVLNode< Data > * | RemoveRoot (AVLTree< Data, ConfigData > *Tree, bool &HasTreeShrunk) |
Remove the root node of an AVL tree. | |
void | SwingLeft (AVLNode< Data > **Root) |
Swing node to the left, NO BALANCE MAINTAINANCE!!! | |
void | SwingRight (AVLNode< Data > **Root) |
Swing node to the right, NO BALANCE MAINTAINANCE!!! | |
void | BalanceAfterNastySwing (AVLNode< Data > *Root) |
Clean up after swings. This is what does the balance maintainance. | |
Protected Attributes | |
AVLNode< Data > * | m_Root |
Root node of the tree. |
Definition at line 20 of file AVLTree.h.
|
Definition at line 335 of file AVLTree.h. References AVLNode< Data >::m_Balance, AVLNode< Data >::m_Left, and AVLNode< Data >::m_Right. Referenced by AVLTree< Data, ConfigData >::Insert(), and AVLTree< Data, ConfigData >::Remove(). |
|
Definition at line 130 of file AVLTree.h. References AVLNode< Data >::m_Data, and AVLTree< Data, ConfigData >::Remove(). Referenced by TestAVLTree(). |
|
Definition at line 244 of file AVLTree.h. References AVLNode< Data >::m_Data, and AVLTree< Data, ConfigData >::RemoveRoot(). |
|
Definition at line 363 of file AVLTree.h. References AVLTree< Data, ConfigData >::Find(), AGenericTree< Data, ConfigData >::m_CompareNodes, AGenericTree< Data, ConfigData >::m_ConfigData, AGenericTree< Data, ConfigData >::m_DeleteTreeData, and AVLTree< Data, ConfigData >::m_Root. |
|
Implements AGenericTree< Data, ConfigData >. Definition at line 357 of file AVLTree.h. Referenced by AVLTree< Data, ConfigData >::Find(), and AVLTree< Data, ConfigData >::Search(). |
|
Definition at line 408 of file AVLTree.h. References AVLTree< Data, ConfigData >::BalanceAfterNastySwing(), AGenericTree< Data, ConfigData >::m_CompareNodes, AVLTree< Data, ConfigData >::m_Root, AVLTree< Data, ConfigData >::SwingLeft(), and AVLTree< Data, ConfigData >::SwingRight(). Referenced by AVLTree< Data, ConfigData >::Search(). |
|
Definition at line 143 of file AVLTree.h. References AVLTree< Data, ConfigData >::BalanceAfterNastySwing(), AGenericTree< Data, ConfigData >::m_CompareNodes, AGenericTree< Data, ConfigData >::m_ConfigData, AGenericTree< Data, ConfigData >::m_DeleteTreeData, AVLTree< Data, ConfigData >::m_Root, AVLTree< Data, ConfigData >::RemoveRoot(), AVLTree< Data, ConfigData >::SwingLeft(), and AVLTree< Data, ConfigData >::SwingRight(). Referenced by AVLTree< Data, ConfigData >::Delete(), and AVLTree< Data, ConfigData >::RemoveRoot(). |
|
Definition at line 257 of file AVLTree.h. References AVLNode< Data >::m_Balance, AVLNode< Data >::m_Data, AVLNode< Data >::m_Left, AVLNode< Data >::m_Right, AVLTree< Data, ConfigData >::m_Root, and AVLTree< Data, ConfigData >::Remove(). Referenced by AVLTree< Data, ConfigData >::DeleteRoot(), and AVLTree< Data, ConfigData >::Remove(). |
|
Implements AGenericTree< Data, ConfigData >. Definition at line 392 of file AVLTree.h. References AVLTree< Data, ConfigData >::Find(), and AVLTree< Data, ConfigData >::Insert(). Referenced by TestAVLTree(). |
|
Definition at line 315 of file AVLTree.h. References AVLNode< Data >::m_Left, and AVLNode< Data >::m_Right. Referenced by AVLTree< Data, ConfigData >::Insert(), and AVLTree< Data, ConfigData >::Remove(). |
|
Definition at line 325 of file AVLTree.h. References AVLNode< Data >::m_Left, and AVLNode< Data >::m_Right. Referenced by AVLTree< Data, ConfigData >::Insert(), and AVLTree< Data, ConfigData >::Remove(). |