Skip to content

Latest commit

 

History

History
43 lines (22 loc) · 1.57 KB

AVLTree.md

File metadata and controls

43 lines (22 loc) · 1.57 KB

AVLTree

Implements: IBinarySearchTree<T>

Represents a node-based, self-balancing IBinarySearchTree enhanced to implement an efficient indexer.


Constructors

AVLTree() Initializes a new instance of AVLTree that is empty.

AVLTree(IEnumerable<T> collection) Initializes a new instance of AVLTree that contains every item from the input collection.

AVLTree(IComparer<T> comparer) Initializes a new instance of AVLTree that is empty and uses the specified IComparer.


Properties

int Count Gets the number of elements stored in the AVLTree. Complexity: O(1)

T Min Gets the minimum value element stored in the AVLTree. Complexity: O(LogN)

T Max Gets the maximum value element stored in the AVLTree. Complexity: O(LogN)

T this[int index] Gets the element at the specified index. Complexity: O(LogN)


Methods

int Insert(T value) Inserts an element into the AVLTree and returns its index. Complexity: O(LogN)

bool Find(T value) Determines whether the AVLTree contains a specific value. Complexity: O(LogN)

bool Remove(T value) Removes one occurrence of a specific element from the AVLTree. Complexity: O(LogN)

T[] InOrderTraverse() Returns the list of the elements stored in the AVLTree in-order. Complexity: O(N)

T[] PreOrderTraverse() Returns the list of the elements stored in the AVLTree pre-order. Complexity: O(N)

T[] PostOrderTraverse() Returns the list of the elements stored in the AVLTree post-order. Complexity: O(N)