Practice30Create account

A word-and-number arrangement machine, when given an input line of words and numbers, rearranges it in steps. In each step the largest number that has not already been shifted is taken out of the line and put back immediately to the left of whichever word then stands furthest to the left. The rest of the line is left exactly as it stands, and the machine finishes when no unshifted number is left.
Step 2 of a certain run of this machine reads: 41 96 58 harbor 27 pilot raven.
Which of the following was the input line?

Competition practiceInput-Output
  • A41 harbor 96 pilot 27 raven 58
  • B96 harbor 27 pilot 41 raven 58
  • C58 harbor 27 pilot 96 raven 41
  • D41 harbor 27 pilot 96 raven 58

Step-by-Step Solution

Run each candidate forward two steps. From 41 harbor 27 pilot 96 raven 58: Step 1 puts 96 in front of harbor, giving 41 96 harbor 27 pilot raven 58; Step 2 puts 58 in front of harbor, giving 41 96 58 harbor 27 pilot raven — a match. The near-misses differ only in where the untouched elements sit, which is exactly what the quoted line pins down: 41 harbor 96 pilot 27 raven 58 reaches 41 96 58 harbor pilot 27 raven, with 27 on the wrong side of pilot; 96 harbor 27 pilot 41 raven 58 reaches 96 58 harbor 27 pilot 41 raven, because 96 already stood in front of harbor and 41 was never the largest; and 58 harbor 27 pilot 96 raven 41 reaches 96 58 harbor 27 pilot raven 41, leaving 41 stranded at the tail. Only the correct input leaves 41 at the head with 27 still between harbor and pilot.
Answer: D) 41 harbor 27 pilot 96 raven 58

Master this topic in 30 minutes a day.

Don't just memorise the answer — build a daily practice habit.

Practice 5 Similar Questions Free →

All Input-Output practice questions

More Input-Output practice

A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…An arrangement machine works on an input line of words and numbers in steps, using only…