Python binary tree module that is self-balancing.
Note: There are probably better libraries that do what you want. Python "bisect" library performs binary search on lists. Additionaly, the "blist" package is awesome and includes "sortedlist" and "sorteddict" among others.
- Small space, Ave: O(n), Max: O(n)
- Fast search, Ave: O(log n), Max: O(log n)
- Fast insert, Ave: O(log n), Max: O(log n)
- Fast delete, Ave: O(log n), Max: O(log n)
- Objects with duplicate values may be added
Uses AVL trees.
New tree
tree = BinaryTree()
Insert Entity into the tree
tree.insert(5, "optional unique ID")