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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:20
What’s resistance in an electrical circuit ?
Answers: 1
question
Computers and Technology, 22.06.2019 10:50
A911 dispatcher is the sole sender of messages to all police officers. while on patrol, officers communicate with the dispatcher who, in turn, relays messages to other officers. the officers do not communicate directly with one another. this illustrates a network.
Answers: 1
question
Computers and Technology, 22.06.2019 15:00
Hyperactive media sales has 10 windows 7 laptop computers used by sales-people in the organization. each laptop computer has several customized applications that are used during the sales process as well as customer relationship management software. all of the applications on the laptops are difficult to configure and have large data files. if all of the laptops have current hardware, what is the easiest way to install windows 10 on them?
Answers: 1
question
Computers and Technology, 23.06.2019 10:00
How do i delete my account on this because i didn't read this agreements and also i put age at xd
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
question
Mathematics, 25.09.2020 18:01
question
Physics, 25.09.2020 18:01
question
Mathematics, 25.09.2020 18:01
question
Mathematics, 25.09.2020 18:01
question
Mathematics, 25.09.2020 18:01
question
Mathematics, 25.09.2020 18:01
question
Mathematics, 25.09.2020 18:01
Questions on the website: 13722367