Question: An AVL-tree is a binary search tree with the following property: For every node, the height of the left subtree and the height of
An AVL-tree is a binary search tree with the following property: For every node, the height of the left subtree and the height of the right subtree differ by at most 1. Note that an empty subtree has height 0 and a subtree containing one node has height 1. (a) Show that an AVL-tree with n-nodes has height at most O(logn). (Hint: Induction and the Fibonancci numbers grow exponentially.) (b) Show that it is always possible to color the nodes in an AVL tree with red or black such that the coloring satisfying the red-black tree property. I.e. this is basically saying that all AVL trees are red-black trees structurally.
Step by Step Solution
3.40 Rating (153 Votes )
There are 3 Steps involved in it
The image contains two parts a and b of a question about AVL trees Lets address each part separately a Show that an AVL tree with nnodes has height at most Olog n To show this we can follow the hint a... View full answer
Get step-by-step solutions from verified subject matter experts
