Public Member Functions | |
| bool | tree_form () const |
| true if object is really a tree (and not a list) | |
| Node * | insert_node (Node *n) |
| template<typename Key_or_Iterator> | |
| void | erase (const Key_or_Iterator &k_or_it) |
| Node * | remove_node (Node *n) |
| int | size () const |
| Return the current number of nodes. | |
| void | init () |
| void | clear () |
| Make the tree empty, destroy the nodes. | |
| tree () | |
| Creates an empty tree. | |
| tree (const tree &t) | |
An AVL tree is a kind of balanced binary search tree, allowing for logarithmic time element find, insert, and delete operations. AVL trees are thoroughly discussed in D.E. Knuth's The Art of Computer Programming, Vol. III, 6.2.3, pp 465ff; http://www-cs-staff.stanford.edu/~knuth/taocp.html
AVL trees play the same role in the polymake library that the red-black trees have in STL: a basis for the associative container classes. The current implementation differs from the red-black trees in following details:
std::less, achieving the acceleration by 1.5 times in average for non-trivial key types.
| pm::AVL::tree< Traits >::tree | ( | const tree< Traits > & | t | ) | [inline] |
| Node* pm::AVL::tree< Traits >::insert_node | ( | Node * | n | ) | [inline] |
| void pm::AVL::tree< Traits >::erase | ( | const Key_or_Iterator & | k_or_it | ) | [inline] |
Delete an element if it exists. Delete the element the iterator points to.
| Node* pm::AVL::tree< Traits >::remove_node | ( | Node * | n | ) | [inline] |
| void pm::AVL::tree< Traits >::init | ( | ) | [inline] |
Makes the tree look like empty. Nodes are not destroyed.