subject

In this problem, you will write some Java code for simple operations on binary search trees where keys are integers. Assume you already have the following code and assume that the method bodies, even though not shown, are correct and implement the operations as we defined them.
public class BinarySearchTreeNode{
public int key;
public BinarySearchTreeNode left;
public BinarySearchTreeNode right;
}
public class BinarySearchTree{
private BinarySearchTreeNode root;
public void insert(int key) {... }
public void delete(int key) { ... }
public SomeType find(int key) { ... }
}
c) Add a method public void printTree() to the BinarySearchTree class that iterates over the nodes to print then in increasing order. So the tree...
4
/ \
2 5
/ \
1 3
Produces the output "1 2 3 4 5".
Note: You will need an assistant/helper method.
d) Add method public void print Postorder() to the BinarySearchTree class that prints out the nodes of the tree according to a "postorder" traversal. So the tree...
4
/ \
2 5
/ \
1 3
Produces the output "1 3 2 5 4".
Note: You will need an assistant/helper method.
e) You have a binary search tree. Consider a leave /. B is the set of keys in the path p of / including the leave / and the root of the tree. A is the set of keys to the left of the path p. C is the set of keys to the right of the path p. Is the following statement true or false? Given any element a in A; b in B; c in C; a ≤ b ≤ c.

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:30, kikilax
What is linux? an open source operating system a version of ms dos the first version of unix the newest technology available
Answers: 1
image
Computers and Technology, 23.06.2019 03:50, dondre54
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 1
image
Computers and Technology, 23.06.2019 22:20, andrew412603
Learning sign language is an example of a(n) learning sign language is an example of a(n)
Answers: 2
image
Computers and Technology, 24.06.2019 15:40, elgallo5399
In the above figure, what type of cylinder arrangement is shown in the figure above? a. l-type b. v-type c. in-line d. horizontal pls make sure its right if its rong im grounded for 3months
Answers: 1
You know the right answer?
In this problem, you will write some Java code for simple operations on binary search trees where ke...

Questions in other subjects:

Konu
Geography, 06.06.2020 21:02