Question: a. Write a method in BinaryNode.java file to count number of leaf nodes in a Binary Tree. (5 points) b. You want to be

a. Write a method in BinaryNode.java file to count number of leafnodes in a Binary Tree. (5 points) b. You want to beable to get the minimum and maximum values from a Binary SearchTree. Rather than add getMin() and getMax() methods to the BinarySearchTree, you

a. Write a method in BinaryNode.java file to count number of leaf nodes in a Binary Tree. (5 points) b. You want to be able to get the minimum and maximum values from a Binary Search Tree. Rather than add getMin() and getMax() methods to the BinarySearchTree, you will create a BSTMinMax class that extends BinarySearch Tree. Use the UML diagram below to implement the BSTMinMAXclass. You do not need to alter the BinarySearchTree or BinaryNode classes in the ds package. c. You may override BinarySearch Tree methods or add additional private attributes and methods as needed to BSTMin. d. Your getMin() and getMax() methods must work as efficiently as possible, that is, each method should not attempt a full traversal of the tree. e. Write at least 2-unit tests in BSTMinMaxTest to test your implementation. < > Comparable + compareTo(o: E) E::Comparable BinarySearch Tree # root: BinaryNode # size: int + BinarySearch Tree(initialValue: T) + toString(): String + size(): int + search(target: T): boolean + insert(value: T) void BinaryNode + BinaryNode(value: T) + toString(): String + getValue(): T + setValue(value: T) + getLeft(): BinaryNode + setLeft(left: BinaryNode ) + getRight(): BinaryNode + setRight(right: BinaryNode ) T::Comparable BSTMinMax + BSTMinMax(initialValue: T) + getMin(): T Recall that T::Comparable indicates that the type parameter T in the BinarySearchTree class will use type Comparable . Your BSTMin class signature should be public class BSTMin extends BinarySearch Tree

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!