At a Cardiff school race, could you work out who won without seeing their shoes?
At a school race in Cardiff, one runner wears red trainers and another wears blue. When you make the results list, do you need to know which shoes each runner wore?
You already know the jobs at a race. Follow the flowchart: start by giving each runner a unique number, then record the times. Sort the records with the lowest time first and output the runner numbers in that order. Splitting the job into smaller tasks is called decomposition.
Look at the full records on the left. Each has a runner number, a time and a shoe colour. Now watch the shorter records appear on the right. You can still compare the times and tell which runner each time belongs to.
You want the results to name each runner by number, with the fastest first. Which pair of details lets you compare times and still identify each runner? Pick one option.
You’ve just used abstraction. You kept the details that the ranking task depends on and left out shoe colour. If the task were to count how many runners wore red shoes, that same detail would matter.
Read the pseudocode: sort by finishing time, lowest first, then output the runner numbers in that order. Try it on the full records. Nineteen seconds is less than twenty-one, so nine comes before four. Remove the shoe colours and repeat. You get the same list: nine, then four.
Runner six finishes in twenty-four seconds and runner eleven finishes in twenty-two seconds. You remove their shoe colours and rank them again. Which runner number should come first? Pick an answer.
Suppose you drop runner numbers as well. You can still sort nineteen and twenty-one seconds, but you can’t tell who earned either place. Keep each number attached to its time so your results can name the runners.
An exam question might ask you to explain why shoe colour can be omitted. Start with what the algorithm uses: finishing times set the order, and runner IDs identify who came where. Changing a shoe colour changes neither, so the same runner IDs appear in the same order.