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
 Spring '11
 NIL
 Algorithms, Data Structures, Englishlanguage films, Subroutine, ASCII

Click to edit the document details