Skip to content

Counting sort

ordering

Level 2 of 3

fresh numbers

The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from counting sort's own run on the numbers shown.

choose one

question 1

Counting sort works on 1, 0, 2, 2, 1, 3. Once the totals are made, what is the total for 2?

10221301234567890000000000
the answer, and why

the answer is D

The tallies for 0, 1 and 2 are 1, 2 and 2. Added up to 2, that is 5.

if you chose another

  • That is the tally for 2 alone.
  • That is the total for 1.
  • That counts every number.

new numbersthe test page's numbers

question 2

How many totals does counting sort add on 0, 9, 9, 6, 2, 0, 9, 5?

0996209501234567890000000000
the answer, and why

the answer is B

One for each value from 1 to 9. The total for 0 is its own tally.

if you chose another

  • That adds to the total for 0 too.
  • That counts only the values in the row.
  • That is how many numbers the row holds.

new numbersthe test page's numbers

question 3

Which row makes counting sort place the most numbers?

the answer, and why

the answer is D

Counting sort makes 8 placings on 4, 0, 1, 4, 0, 1, 9, 9, one for each number it holds, the most of the four.

if you chose another

  • Counting sort makes 7 placings on this row, one for each number it holds, fewer than 8.
  • Counting sort makes 2 placings on this row, one for each number it holds, fewer than 8.
  • Counting sort makes 6 placings on this row, one for each number it holds, fewer than 8.

new numbersthe test page's numbers