ScreenshotImplement an efficient method that rebalances BSTs that do not have a count field in their nodes.

Modify the standard BST insertion method in to use to rebalance the tree each time that the number of items in the symbol table reaches a power of 2. Compare the running time of your program with that of for the tasks of (i) building a tree from N random keys and (ii) searching for N random keys in the resulting tree, for N = 103, 104, 105, and 106.

Estimate the number of comparisons used by your program from when inserting an increasing sequence of N keys into a symbol table.

Java graphics roundbulletJava graphics roundbullet 13.4 Show that runs in time proportional to N log N for a degenerate tree. Then give as weak a condition on the tree as you can that implies that the program runs in linear time.

Modify the standard BST insertion method in to partition about the median any node encountered that has less than one-quarter of its nodes in one of its subtrees. Compare the running time of your program with that of for the tasks of (i) building a tree from N random keys and (ii) searching for N random keys in the resulting tree, for N = 103, 104, 105, and 106.

Estimate the number of comparisons used by your program from when inserting an increasing sequence of N keys into a symbol table.

Java graphics roundbullet 13.7 Extend your implementation in to rebalance in the same way while performing the remove operation. Run experiments to determine whether the height of the tree grows as a long sequence of alternating random insertions and deletions are made in a random tree of N nodes, for N = 10, 100, and 1000, and for N2 insertion-deletion pairs for each N.