This preview shows page 1. Sign up to view the full content.
Unformatted text preview: and that the depth of a node n is the length of the path from the root to n . Complete the method public int depth (AnyType x) in BinaryHeapWithDepth such that it returns the smallest depth of a node that contains an item equal to x. 4. Modify the class search.BinarySearchTree such that it keeps track of multiple copies of elements. The method insert adds a copy, and the method remove removes a copy (if it is present). Two elements item1 and item2 are considered copies of the same element, iF item1 . compareTo ( item2 ) returns 0. The method contains should return true if there is at least one copy of the element. Complete the method instances which should return the number of copies of a given element that is currently contained in the tree. 1...
View
Full
Document
This note was uploaded on 06/09/2011 for the course CS 11025 taught by Professor Nil during the Spring '11 term at National University of Singapore.
 Spring '11
 NIL
 Algorithms, Data Structures

Click to edit the document details