Services
Discover
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Big Java Early Objects
Exam 17: Tree Structures
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 1
Multiple Choice
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.
Question 2
Multiple Choice
What is the efficiency of locating an element in a red-black tree?
Question 3
Multiple Choice
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?
Question 4
Multiple Choice
Consider the following tree diagrams:
Which are binary search trees?
Question 5
Multiple Choice
What are the differences between preorder, postorder, and inorder traversals?
Question 6
Multiple Choice
What is the efficiency of the heapsort algorithm?
Question 7
Multiple Choice
Consider the following binary search tree:
Which of the following sequences correctly represents breadth-first traversal of this tree?
Question 8
Multiple Choice
Consider the following tree diagram:
Which of the following statements is NOT correct?
Question 9
Multiple Choice
A binary tree of height h can have up to ____ nodes.
Question 10
Multiple Choice
What is the efficiency of removing an element from a red-black tree?
Question 11
Multiple Choice
Which of the following statements about a heap is NOT correct?
Question 12
Multiple Choice
Consider the following tree diagram:
What is the size of the subtree with root R?
Question 13
Multiple Choice
Removing an element from a balanced binary search tree takes ____ time.
Question 14
Multiple Choice
Consider the following tree diagram:
Which of the following nodes are interior nodes?
Question 15
Multiple Choice
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.
Question 16
Multiple Choice
Adding an element to a balanced binary search tree takes ____ time.
Question 17
Multiple Choice
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