Skip to content
KALANBLON
Show contents

Chapter 7 of 7 · 10 min

Quiz: prioritise

Priority queues, binary search trees and choosing structures: last quiz of this course. You need 70% correct answers to pass it.

Quiz

7 questions · pass mark: 70%

  1. 1.After a series of heappush calls, what does heapq guarantee about the list heap?

    One answer

  2. 2.How much does heappush or heappop cost on a heap of n items?

    One answer

  3. 3.In a heap of (severity, number, patient) tuples, what is the arrival number for?

    One answer

  4. 4.In a binary search tree, where are the values smaller than a node?

    One answer

  5. 5.Complete the traversal that gives a BST's values in ascending order.

    Complete the code

    def in_order(n, res):
        if n is not None:
            in_order(n.left, res)
            res.append(n.value)
            in_order(n.____, res)
        return res
  6. 6.You insert 1, 2, 3, …, 1000 in that order into a simple BST. What happens?

    One answer

  7. 7.Match the right tool: which statements are correct? (several answers)

    Several answers possible

Your progress is saved on this device. Create a free account to keep your progress on all your devices.