Skip to content

UnbalancedBinaryTree

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

Home > Trees > IBinaryTree > UnbalancedBinaryTree

UnbalanceBinaryTree

As the name suggests an UnbalanceBinaryTree is a BinaryTree implementation which implements an unbalanced binary tree. This means that the tree is never balanced so the order in which items are inserted or deleted from the tree can have a significant effect on lookup performance.

API

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

Creation

An unbalanced tree is relatively simple to create:

//Use the default comparer for the keys
UnbalancedBinaryTree<String, int> tree = new UnbalancedBinaryTree<String, int>();

//Use a custom comparer for the keys
tree = new UnbalancedBinaryTree<String, int>(StringComparer.Ordinal);

Other Operations

All other operations follow the standard ITree interface.

Clone this wiki locally