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.
Input: 34 pearl 61 vine 27 dome 85 kite.
Which of the following is Step 2 of the above arrangement?

Competition practiceInput-Output
  • A34 85 pearl 61 vine 27 dome kite
  • B34 85 61 pearl vine 27 dome kite
  • C61 85 34 pearl vine 27 dome kite
  • D34 61 85 pearl vine 27 dome kite

Step-by-Step Solution

The leftmost word is pearl throughout. Step 1: the largest number, 85, is lifted out and dropped immediately before pearl, giving 34 85 pearl 61 vine 27 dome kite. Step 2: the largest number still unshifted is 61, which is lifted out and dropped immediately before pearl, giving 34 85 61 pearl vine 27 dome kite. Stopping at Step 1 leaves 61 in mid-line. The familiar machine that sends each number to the extreme left end would have produced 61 85 34 pearl vine 27 dome kite instead, with 34 pushed along rather than left alone at the head. The last line puts 61 on the wrong side of 85, forgetting that each new number is inserted next to the word, not next to the number placed before it.
Answer: B) 34 85 61 pearl vine 27 dome kite

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,…A word-and-number arrangement machine, when given an input line of words and numbers,…