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 3, 0, 2, 3, 1, 0. Once the totals are made, what is the total for 2?

30231001234567890000000000
the answer, and why

the answer is D

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

if you chose another

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

new numbers

question 2

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

7275290701234567890000000000
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 numbers

question 3

Which row makes counting sort place the most numbers?

the answer, and why

the answer is C

Every row places one number for each it holds. The nine 0s are the most numbers.

if you chose another

  • Eight numbers, eight placings, whatever their order.
  • Seven numbers, seven placings.
  • Six numbers, six placings; repeats change nothing.

new numbers