Skip to content
KALANBLON
Show contents

Chapter 3 of 7 · 10 min

Quiz: measure and sort

Complexity, binary search, recursion and sorting: let's check that you can measure an algorithm. You need 70% correct answers, and every answer is explained.

Quiz

6 questions · pass mark: 70%

  1. 1.An O(n²) algorithm processes 1,000 items in 1 second. Roughly how long for 10,000 items?

    One answer

  2. 2.What condition does binary search require?

    One answer

  3. 3.Why is “if x in a_set” faster than “if x in a_list” on large volumes?

    One answer

  4. 4.What does a correct recursive function need? (several answers)

    Several answers possible

  5. 5.What is the complexity of merge sort?

    One answer

  6. 6.Roughly how many comparisons at most for a binary search in 1,000,000 sorted items? (a number)

    Complete the code

    # 1,000,000 → 500,000 → 250,000 → … → 1
    max_comparisons = ____

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