modify the standard definition of a binary search tree to add a field N.size at each Suppose that we

modify the standard definition of a binary search tree to add a field N.size at each Suppose that we node, which records the size of the subtree under N'Tincluding N itself). A. Explain how to modify the procedure for adding both the case where X is not yet in the tree and is added, and the case where X is already in the tree, and the tree remains unchanged. element X to a tree. Be sure to consider an You only need to describe the changes that are made to the standard algorithm; you do not have to repeat the standard algorithm. B. Explain how to modify the procedure for deleting an element. As in (A), consider both cases. C. Describe a procedure for finding the kth largest element in the tree. D. Describe a procedure for finding the number of elements in the tree less than X All of these procedures should run in time proportional to the height of the tree.

 

Looking for a Similar Assignment? Hire our Top Uk Tutors while you enjoy your free time! All papers are written from scratch and are 100% Original. Try us today! Active Discount Code FREE15