Exam 17: Tree Structures
Exam 1: Introduction76 Questions
Exam 2: Using Objects82 Questions
Exam 3: Implementing Classes108 Questions
Exam 4: Fundamental Data Types124 Questions
Exam 5: Decisions119 Questions
Exam 6: Loops107 Questions
Exam 7: Arrays and Array Lists117 Questions
Exam 8: Designing Classes88 Questions
Exam 9: Inheritance99 Questions
Exam 10: Interfaces100 Questions
Exam 11: Input/Output and Exception Handling108 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion99 Questions
Exam 14: Sorting and Searching100 Questions
Exam 15: The Java Collections Framework102 Questions
Exam 16: Basic Data Structures102 Questions
Exam 17: Tree Structures102 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Stream Processing85 Questions
Exam 20: Graphical User Interfaces75 Questions
Exam 21: Advanced Input/Output90 Questions
Exam 22: Multithreading81 Questions
Exam 23: Internet Networking74 Questions
Exam 24: Relational Databases75 Questions
Exam 25: XML74 Questions
Select questions type
Given the Node class (partially shown below), select an expression to complete the isLeaf method, which is designed to return true if the node is a leaf, false otherwise.

Free
(Multiple Choice)
4.9/5
(39)
Correct Answer:
A
What is the efficiency of locating an element in a red-black tree?
Free
(Multiple Choice)
4.8/5
(33)
Correct Answer:
D
Consider the following binary search tree diagram:
Consider the following addNode method for inserting a newNode into a binary search tree:
public void addNode(Node newNode)
{
int comp = newnode.data.compareTo(data);
if (comp < 0)
{
if (left == null) {left = newNode;}
else { left.addNode(newNode); }
}
else
{
if (right == null) {right = newNode;}
else { right.addNode(newNode); }
}
}
Which of the following trees represents the correct result after inserting element T, calling addNode on the root of the tree?


Free
(Multiple Choice)
4.9/5
(32)
Correct Answer:
A
Consider the following tree diagrams:
Which are binary search trees?

(Multiple Choice)
4.8/5
(39)
What are the differences between preorder, postorder, and inorder traversals?
(Multiple Choice)
4.9/5
(32)
Consider the following binary search tree:
Which of the following sequences correctly represents breadth-first traversal of this tree?

(Multiple Choice)
4.8/5
(46)
Consider the following tree diagram:
Which of the following statements is NOT correct?

(Multiple Choice)
5.0/5
(43)
What is the efficiency of removing an element from a red-black tree?
(Multiple Choice)
4.8/5
(36)
Which of the following statements about a heap is NOT correct?
(Multiple Choice)
4.8/5
(31)
Consider the following tree diagram:
What is the size of the subtree with root R?

(Multiple Choice)
4.7/5
(42)
Removing an element from a balanced binary search tree takes ____ time.
(Multiple Choice)
4.8/5
(31)
Consider the following tree diagram:
Which of the following nodes are interior nodes?

(Multiple Choice)
4.9/5
(40)
The height of a tree can be obtained by recursively computing the heights of its subtrees, while keeping track of the height of the deepest subtree.Given the Node class (partially shown below), select an expression to complete the recursive method height, which is designed to return the height of the tree rooted at a node.

(Multiple Choice)
5.0/5
(43)
Adding an element to a balanced binary search tree takes ____ time.
(Multiple Choice)
4.9/5
(37)
You wish to traverse a binary search tree using postorder traversal.Arrange the following actions in the correct order to accomplish this.
i.Print the right subtree recursively
II.Print the root
III.Print the left subtree recursively
(Multiple Choice)
4.9/5
(41)
Locating an element in an unbalanced binary search tree takes ____ time.
(Multiple Choice)
4.9/5
(42)
Consider the following tree diagram:
Which of the following statements is NOT correct?

(Multiple Choice)
4.7/5
(38)
Which of the following is a correct statement about red-black trees?
(Multiple Choice)
4.7/5
(29)
Showing 1 - 20 of 102
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)