Exam 15: Heaps and Priority Queues

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

A heap sort sorts elements by constructing a heap out of them, and then removing them one at a time from the root.

(True/False)
4.8/5
(40)

In a binary search tree, the elements in the right subtree of the root are __________________ the root element.

(Multiple Choice)
4.9/5
(37)

What is a binary search tree?

(Essay)
4.9/5
(38)

In a maxheap, the largest element in the structure is always ______________________ .

(Multiple Choice)
4.8/5
(36)

What is special about the order in which the nodes are visited in an inorder traversal of a binary search tree.

(Short Answer)
4.8/5
(32)

The most efficient binary search trees are balanced.

(True/False)
4.8/5
(37)

Consider the following binary search tree. Consider the following binary search tree.    What is the result of removing the following elements (in order): 13, 16, 12. What is the result of removing the following elements (in order): 13, 16, 12.

(Short Answer)
4.7/5
(34)

Suppose we have a class called BinaryTree that includes a find method. If we extend the class to create a BinarySearchTree class, should we override the find method or use it as is? Explain.

(Essay)
4.9/5
(41)

Explain how an element is added to a heap.

(Essay)
4.8/5
(40)

Which of the following is always true when adding an element to a heap?

(Multiple Choice)
4.9/5
(42)

Draw a binary search tree that results from inserting the following elements: 12, 16, 9, 1, 15, 13

(Essay)
4.8/5
(44)

Finding an element in a binary search tree always requires O(log2 n) comparisons.

(True/False)
4.7/5
(33)

Explain how to add an element to a binary search tree.

(Essay)
5.0/5
(29)

What is the inorder successor of a node in a binary search tree?

(Essay)
4.9/5
(47)

Describe the steps involved in performing a right rotation on a node in a binary search tree.

(Essay)
4.8/5
(33)

In a binary search tree, a new element is always added as a leaf.

(True/False)
4.8/5
(37)

Whenever a new element is added to a maxheap, it always becomes the root.

(True/False)
4.8/5
(31)

What is a heap?

(Essay)
4.9/5
(39)

Why is it important to keep a binary search tree balanced?

(Short Answer)
4.8/5
(29)

When removing an element from a binary search tree that has a single child, _____________________ will ensure that the resulting tree is still a binary search tree.

(Multiple Choice)
4.8/5
(29)
Showing 21 - 40 of 40
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)