Embercode
✕
SortingQuick quiz

Timing

6 questions. Covers Timing and counting comparisons in Python.

Questions 1 to 5 of 6

  1. 1. Selection sort makes n times (n minus 1) divided by 2 comparisons on every input. Which growth class does this count belong to?
  2. 2. On random input, bubble sort's full comparison count grows with the square of the list length. If the list grows from 100 values to 200 values, about how many times more comparisons does bubble sort make?
  3. 3. Which sorts do exactly one adjacent move for each inversion in the input? An inversion is a pair of values that are in the wrong order.
  4. 4. A student times bubble sort once on 5000 numbers and reports that single number. Which change makes the timing trustworthy?
  5. 5. True or false: selection sort makes fewer comparisons on an already sorted list of 100 values than on a random list of 100 values, because it stops early when the list is sorted.

5 question(s) left on this page.