Exam 15: Heaps and Priority Queues

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

In a balanced binary search tree, adding an element always requires approximately O(log2 n) steps.

Free
(True/False)
4.9/5
(37)
Correct Answer:
Verified

True

Finding an element in a balanced binary search tree that contains n elements requires _____________________ comparisons.

Free
(Multiple Choice)
4.8/5
(30)
Correct Answer:
Verified

D

Left and right rotations can be used to rebalance an unbalanced binary search tree.

Free
(True/False)
4.9/5
(34)
Correct Answer:
Verified

True

In a binary search tree, the elements in the right subtree of the root are always larger than the element stored at the root.

(True/False)
4.8/5
(32)

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

(Multiple Choice)
4.9/5
(40)

In a maxheap, the largest element is always the root.

(True/False)
4.8/5
(41)

A ____________________ is a complete binary tree in which each element is greater than or equal to both of its children.

(Multiple Choice)
4.8/5
(36)

A binary search tree is always a full tree.

(True/False)
4.8/5
(38)

Describe how to find an element in a binary search tree. You may use English sentences or pseudocode.

(Essay)
4.9/5
(37)

Explain how heap sort works.

(Essay)
4.8/5
(31)

In the worst case, a general binary search tree could require __________________ comparisons to find an element.

(Multiple Choice)
4.8/5
(47)

When removing an element from a binary search tree that is a leaf, ______________ will ensure that the resulting tree is still a binary search tree.

(Multiple Choice)
4.9/5
(42)

A _____________________ is a tree whose elements are organized to facilitate finding a particular element when needed.

(Multiple Choice)
4.8/5
(36)

When adding a new element to a binary search tree, the element is added as a(n) ______________.

(Multiple Choice)
4.8/5
(42)

When removing an element from a binary search tree that has two children, _______________________ will ensure that the resulting tree is still a binary search tree.

(Multiple Choice)
4.8/5
(33)

Does the find and add operations on a binary search tree always require at most O(log2 n) comparisons? If so, why? If not, why not?

(Essay)
5.0/5
(31)

Explain the process of removing an element from a binary search tree.

(Essay)
4.9/5
(34)

If a binary search tree becomes unbalanced after an element is added, it is sometimes possible to efficiently rebalance the tree by ___________________ .

(Multiple Choice)
4.7/5
(41)

When removing an element from a binary search tree, we must always ______________________.

(Multiple Choice)
4.8/5
(26)

A binary search tree that is highly unbalanced is called a ________________ tree.

(Multiple Choice)
5.0/5
(36)
Showing 1 - 20 of 40
close modal

Filters

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