Embercode
✕
SortingQuick quiz

Timing

6 questions. Covers Timing and counting comparisons.

Questions 1 to 5 of 6

  1. 1. The lesson counts the comparisons insertion sort makes on reversed input of 20000 values. How many comparisons is that?

    Type a number.

  2. 2. Insertion sort runs on a list of 1000 values that is already sorted. How many comparisons and swaps does it make?
  3. 3. Which clock does the timing program use, and why?
  4. 4. A teammate builds the timing program with plain g++ and no optimisation flag, so the build is -O0. Selection sort is now slower than insertion sort. What is the right conclusion?
  5. 5. True or False: on a list of 1000 random values, selection sort makes the same number of comparisons as it does on a list of 1000 values that is already sorted.

5 question(s) left on this page.

Typed answers ignore extra spaces and, for most questions, capital letters.