# Binary Search Trees ASSIGNMENT:&nbsp; &nbsp;&nbsp; &...

## Question

Binary Search Trees
ASSIGNMENT:
1. In the downloaded code, six different classes and interfaces include the word “tree.” List them.
2. Which two from question #1 are interfaces?
3. Of the two interfaces from question #2, which one is the parent?
4. Of the four classes in question #1, which one…
a. represents a node in a tree?
b. represents a tree that doesn’t necessarily keep elements ordered?
c. represents a tree that keeps its elements ordered?
d. represents a list that is implemented with a tree?
e. For your answer to part (d) – does it implement an OrderedList or an UnorderedList?
5. LinkedBinarySearchTree has a parent class and it implements an interface.
a. What is its parent class?
b. What interface does it implement?
c. What would be the name of another class that could implement the interface? (If necessary, see 19.2 to remind yourself of other ways to implement trees. You do not need to actually implement another tree. This is just a reminder that there are other ways to implement trees besides links.)
6. Where is LinkedBinarySearchTree’s toString method? Hint: it is inherited.
a. Class:
b. Line number:
a. Parameter for the one-parameter version:
b. Parameters for the two-parameter version:
c. Why are the two versions of the method needed?

Programming Exercises
1. (12 points) Recall that LinkedBinarySearchTree is not a balanced tree. In the Asn12 main program, instantiate a LinkedBinarySearchTree object and insert the following Integers in this order: 40, 22, 32, 42, 25, 35, 45, 50, 55, 60. Draw the resulting tree here:
2. (5 points) Print out the tree from #1. Note that it is simply printed in order using an in-order iterator.
3. (15 points)
a. Write the findMin() method in LinkedBinarySearchTree.
b. Write findMax().
c. Write removeMax().
Hint: use findMax() and removeElement() to write removeMax().
4. (6 points) The LinkedBinarySearchTree implementation is not balanced. Suppose we wanted to implement an AVL tree. (Although we won’t get that far.) We would need to calculate the balance factor of a node. Write the method called getBalanceFactor(BinaryTreeNode<T> node). It will use getHeight to calculate the balance factor of a node.
5. (2 points) Write a method called isBalanced that uses getBalanceFactor to determine if a node is balanced. Recall that a balance factor of 2 or greater, or of -2 or smaller, is unbalanced.

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

1. In the downloaded code, six different classes and interfaces include the word “tree.” List them.
b. BinarySearchTreeList
d. BinaryTreeNode

2. Which two from question #1 are interfaces?

3. Of the two interfaces from question #2, which one is the parent?

4. Of the four classes in question #1, which one…
a. represents a node in a tree?
i. BinaryTreeNode

b. represents a tree that doesn’t necessarily keep elements ordered?

c. represents a tree that keeps its elements ordered?
i. BinarySearchTreeList

d. represents a list that is implemented with a tree?
BinarySearch...

By purchasing this solution you'll be able to access the following files:
Solution.docx and Solution.zip.

# 50% discount

Hours
Minutes
Seconds
\$45.00 \$22.50
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Data Structures and Algorithms Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.