Exam 11: Binary Search Trees
Exam 1: Introduction36 Questions
Exam 2: Analysis of Algorithms31 Questions
Exam 3: Introduction to Collections - Stacks49 Questions
Exam 4: Linked Structures - Stacks51 Questions
Exam 5: Queues28 Questions
Exam 6: Lists42 Questions
Exam 7: Iterators32 Questions
Exam 8: Recursion57 Questions
Exam 9: Searching and Sorting54 Questions
Exam 10: Trees47 Questions
Exam 11: Binary Search Trees50 Questions
Exam 12: Heaps and Priority Queues29 Questions
Exam 13: Sets and Maps47 Questions
Exam 14: Multi-Way Search Trees47 Questions
Exam 15: Graphs29 Questions
Exam 16: UML16 Questions
Exam 17: Object-Oriented Design54 Questions
Select questions type
The removeMin operation for both the linked and array implementations is O(log n).
Free
(True/False)
4.9/5
(34)
Correct Answer:
True
The removeMin operation for both implementations replaces the element at the root with the element in the last leaf of the heap. Why is this the proper replacement?
Free
(Essay)
4.8/5
(40)
Correct Answer:
To maintain the completeness of the tree, the only valid replacement for the element at the root is the element at the last leaf. Then the heap must be reordered as necessary to maintain the ordering property.
In an array implementation of a binary tree, the root of the tree is in position 0, and for each node n, n's left child is in position ______ and n's right child is in position ______.
Free
(Short Answer)
4.9/5
(33)
Correct Answer:
2n+1, 2(n+1
Because of the requirement that we be able to traverse up the tree after an insertion, it is necessary for the nodes in a heap to store a pointer to their ______.
(Short Answer)
4.8/5
(35)
The __________ method adds a given Comparable element to the appropriate location in the heap, maintaining both the completeness property and the ordering property of the heap.
(Multiple Choice)
4.9/5
(45)
Typically, in heap implementations, we keep track of the position of the last node or, more precisely, the last leaf in the tree.
(Multiple Choice)
4.8/5
(34)
Because of the requirement that we be able to traverse up the tree after an insertion, it is necessary for the nodes in a heap to store a pointer to their parent.
(True/False)
4.7/5
(35)
A minheap is a complete binary tree in which each node is less than or equal to both the left child and the right child.
(Multiple Choice)
4.7/5
(39)
A minheap is a complete ______ tree in which each node is less than or equal to both the left child and the right child.
(Short Answer)
4.8/5
(34)
In an array implementation of a binary tree, the root of the tree is in position 0, and for each node n, n's left child is in position ________ and n's right child is in position ________.
(Multiple Choice)
4.8/5
(24)
Though not a queue at all, a minheap provides an efficient implementation of a priority queue.
(True/False)
4.8/5
(37)
To maintain the completeness of the tree, there is only one valid element to replace the root, and that is the element stored in the first leaf in the tree.
(True/False)
4.8/5
(34)
Since a heap is a binary search tree, there is only one correct location for the insertion of a new node, and that is either the next open position from the left at level h or the first position on the left at level h+1 if level h is full.
(True/False)
4.9/5
(44)
What is the difference between a heap (a minheap) and a binary search tree?
(Essay)
4.8/5
(43)
The heapSort method consists of adding each of the elements of the list to a ______ and then removing them one at a time. If the heap is a minheap, this results in ______ order. However, if the heap is a maxheap, this results in ______ order.
(Short Answer)
4.8/5
(34)
To maintain the completeness of the tree, there is only one valid element to replace the ________, and that is the element stored in the last leaf in the tree.
(Multiple Choice)
4.8/5
(31)
The removeMin operation for both the linked and array implementations is O(______)
(Short Answer)
4.9/5
(48)
A minheap is a complete binary tree in which each node is less than or equal to both the left child and the right child.
(True/False)
4.7/5
(29)
Showing 1 - 20 of 50
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)