Developer Documentation |
RAVL, Recognition And Vision Library |
AVLTreeC<class KeyT,class DataT>
|
|
AVL Tree.
|
|
include | "Ravl/AVLTree.hh" |
Source file: | Ravl/Core/Container/Trees/AVLTree.hh |
User Level: | Normal |
Library: | RavlCore |
Example: | exAVLTree.cc |
In Scope: | RavlN |
Comments:
AVL (Adelson-Velskii and Landis) binary trees gives approximantly O(log N)
for all operations.
Deletion is partly lazy, it will only remove nodes that are
easy, the rest it flags for removal later.
Parent Classes:
Methods:
- AVLTreeC()
-
Default constructor.
Creates an invalid handle.
- AVLTreeC(bool)
-
Default constructor.
Creates an invalid handle.
- BinaryTreeBodyC<KeyT,DataT> & Body()
-
Access body.
- const BinaryTreeBodyC<KeyT,DataT> & Body() const
-
Access body.
- BinaryTreeC Copy() const
-
Make a copy of this tree.
- void Empty()
-
Empty the tree of all contents.
- SizeT Size() const
-
Number of elements in tree.
- bool IsEmpty() const
-
Is tree empty ?
- bool Find(const KeyT & key,DataT & result)
-
Find a data item with 'key' in the tree.
return true if found, false otherwise.
- bool Remove(const KeyT & key)
-
Remove item from tree.
- bool Insert(const KeyT & key,const DataT & dat,bool overwrite = true)
-
Insert a node into the tree.
If 'overwrite' is true, and a node with the given
key is already in the tree then it will be overwritten
otherwise 'false' will be returned.
- DataT & MinData()
-
Get the data with smallest key in the tree.
Note, the tree must NOT be empty, this can be checked with IsEmpty().
- DataT & MaxData()
-
Get the data at the largest key in the tree.
Note, the tree must NOT be empty, this can be checked with IsEmpty().
- const KeyT & MinKey() const
-
Get the smallest key in the tree.
Note, the tree must NOT be empty, this can be checked with IsEmpty().
- const KeyT & MaxKey() const
-
Get the largest key in the tree.
Note, the tree must NOT be empty, this can be checked with IsEmpty().
- void Dump(ostream & out)
-
Dump the stream in a human readable fomat.
Usefull for debuging.
- const RCHandleC<BinaryTreeBodyC<KeyT,DataT>> & operator =(const RCHandleC<BinaryTreeBodyC<KeyT,DataT>> & oth)
-
Assign handle.
- RCHandleC<BinaryTreeBodyC<KeyT,DataT>> DeepCopy(UIntT levels = ((UIntT))) const
-
Do a deep copy of the object.
- bool operator ==(const RCHandleC<BinaryTreeBodyC<KeyT,DataT>> & oth) const
-
Are handles to the same object ?
- bool operator !=(const RCHandleC<BinaryTreeBodyC<KeyT,DataT>> & oth) const
-
Are handles to different objects ?
- UIntT Hash() const
-
Default hash function.
This hashes on the address of the body.
- bool IsValid() const
-
Test if this is a valid handle.
- void Invalidate()
-
Invalidate this handle.
Unattaches the body from the handle.
- bool IsHandleType(const DT &) const
-
Is handle of given type ?
- void CheckHandleType(const DT & dummy) const
-
Check handle type. Throw an expception if not.
- BinaryTreeBodyC<KeyT,DataT> & Body()
-
Access body of object.
- const BinaryTreeBodyC<KeyT,DataT> & Body() const
-
Constant access to body of object.
- UIntT References() const
-
Find the number of references to the body of this object.
- ostream & operator <<(ostream & strm,const RCHandleC<BinaryTreeBodyC<KeyT,DataT>> & obj)
-
- istream & operator >>(istream & strm,RCHandleC<BinaryTreeBodyC<KeyT,DataT>> & obj)
-
Maintainer:Charles Galambos, Documentation by CxxDoc: Tue Aug 13 09:59:30 2002
|