Answered You can hire a professional tutor to get the answer.

QUESTION

Let A be an array consisting of elements in the following order 29,30, 25,36, 34,72, 15, 17, 11 (a) Draw the binary search tree that is obtained by

Let A be an array consisting of elements in the following order

                              29,30, 25,36, 34,72, 15, 17, 11

(a) Draw the binary search tree that is obtained by adding/inserting the elements (without balancing) in the order they appear in the array.

(b) If the resulting tree is not balanced, perform balancing as per AVL tree discussed in balancing) in the order they appear in the array. lectures. Specify the steps needed to balance (left rotation/right rotation etc.) and draw the resulting balanced tree.

(c) Draw the hash table (using chain hashing) obtained by adding the above elements using the hash function (3x+1)%5.

(d) For a BST T and a node N in T, let B(N) = height of left sub tree of N-height of right subtree of N.

Note that B(N) could be positive, negative or 0. Let T be the following BST: The root node is X, it has a left subtree named R and a right subtree rooted at Y. The node Y has a right subtree Z and a left subtree rooted at node U. The node U has two sub trees V and W. Suppose that B(U) = 0. B(Y)=1 and B (X)= 2.

 Draw the tree obtained by balancing T. Draw the intermediate trees (if any) obtained while balancing. Once you balance the tree, what are B(X), B(Y) and B(U)?

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question