- Inherits from:
- Object
- Declared in:
- DAvlTree.h
Object
|
+---DAvlTree
Class Description
The avl tree collection class implements a number of methods for creating,
inserting, searching and removing (elements in) an avl tree. The implementation is
inspired by the book "Algorithms & Data structures" by N. Wirth.
- Last modified:
- 27-Feb-2005 (DAvlTree.h)
Instance Variables
- private DAvlNode *_root
- the root of the avl-tree
- private Class _class
- the class of the key
- private long _count
- the number of nodes in the avl tree
- Constructors
- - (DAvlTree *) init
- Initialise to an unitialised avl tree (not implemented)
- Returns:
- the object
- - (DAvlTree *) init :(Class) key
- Initialise to an empty avl tree
- Parameters:
- key - the class of the key
- Returns:
- the object
- Deconstructors
- - free
- (Deep) free the avl tree (keys are freed, objects are *FREED*)
- Returns:
- the object
- - shallowFree
- Free the avl tree (keys are freed, objects are *NOT* freed)
- Returns:
- the object
- Copy related methods
- - deepen
- Deepen a copied avl tree (not implemented)
- Returns:
- the object
- Member methods
- - (BOOL) isEmpty
- Check if the avl tree is empty
- Returns:
- is it?
- - (long) length
- Return the number of objects in the tree
- Returns:
- the length
- Avl tree manipulation
- - (id) delete :(id) key
- Remove a key,object from the avl tree
- Parameters:
- key - the key to be removed
- Returns:
- the object that is removed (or nil for not found)
- - get :(id) key
- Return the object related to a key
- Parameters:
- key - the key
- Returns:
- the object related to the key (or nil)
- - (BOOL) has :(id) key
- Check if the avl tree contains a key
- Parameters:
- key - the key to be checked
- Returns:
- is the key present
- - (BOOL) insert :(id) key :(id) object
- Insert a key,object in the avl tree
- Parameters:
- key - the key to be inserted
object - the object to be inserted
- Returns:
- success
- List related functions
- - (DList *) keys
- Return a list with copies of all keys (sorted) in the avl tree
- Returns:
- a (new) sorted list with all the keys
- - (DList *) objects
- Return a list with copies of all the objects in the avl tree
- Returns:
- a (new) list with all the objects
- - (DList *) rkeys
- Return a list with copies of all keys (reverse sorted) in the avl tree
- Returns:
- a (new) reverse sorted list with all the keys
generated 08-Jan-2006 by ObjcDoc 3.0.0