Skip to content

AVLTree

Kal Ahmed edited this page Sep 26, 2016 · 1 revision

Home > Trees > IBinaryTree > AVLTree

AVLTree

AVLTree is a BinaryTree implementation that implements the standard AVL Tree data structure. An AVL tree is a self balancing binary tree so it ensures that operations are always O(log n).

API

As with all our examples we assume a tree mapping from strings to integers for simplicity.

Creation

Creating an AVLTree can be done in one of two ways:

//Use the default comparer for the key type
AVLTree<String, int> tree = new AVLTree<String, int>();

//Alternatively we can supply a specific comparer for the key type
tree = new AVLTree<String, int>(StringComparer.OrdinalIgnoreCase);

Other Operations

All other operations follow the normal ITree API, please see examples there.

Clone this wiki locally