AVL Trees Homework Help
Height Of A Node:
- The height of a leaf is actually 1. The height of a null pointer is zero.
- The height of an internal node is the maximum height of its children plus 1
- An AVL tree is a binary search tree in which
- For every node in the tree, the height of the left and right subtrees differ by at most 1.
- For every node in the tree, the height of the left and right subtrees differ by at most 1.
- Let x be the root of an AVL tree of height h
- Let Nh denote the minimum number of nodes in an AVL tree of height h
- Clearly, Ni ≥ Ni-1 by definition
- We have,
- By repeated substitution, we obtain the general form
- The boundary conditions are: N1=1 and N2 =2. This implies that h = O(log Nh).
- Thus, many operations (searching, insertion, deletion) on an AVL tree will take O(log N) time.
Inputs
Only positive, single to double digit integers are permitted (e.g. {"37"} or {"3"}). Wrong kinds of data are ignored by the applet.
Insert
Insert an integer within the binary tree. Node comparisons will appear in the bottom panel of the applet.
Search
Search for an integer within the binary tree. Node comparisons will appear in the bottom panel of the applet, including whether or not the requested node exists within the binary tree.
Delete
Delete an integer in the binary tree. Node comparisons will appear in the bottom panel of the applet, including whether or not the requested node can be deleted from the binary tree (i.e. if it exists within the tree or not).