Practice30Create account

An arrangement machine reshuffles an input line by reversing a block of elements at the left end, one block per step. In Step 1 it reverses the order of the first two elements, in Step 2 the first three elements, in Step 3 the first four, and so on, each step reversing one element more than the step before. Nothing is added to or taken out of the line, and the machine stops after the step that reverses the whole line.
Input: 52 amber 17 crest 46 dune 73 flint 28.
How many steps are needed to complete the rearrangement of the above input?

Competition practiceInput-Output
  • A9
  • B8
  • C7
  • D4

Step-by-Step Solution

The line holds nine elements. Step 1 reverses two of them, Step 2 reverses three, and so on, so the block being reversed always covers one more element than the step number. The whole line of nine is therefore reversed at Step 8, which is where the machine halts: 28 73 46 17 52 amber crest dune flint. Counting one step per element gives nine, which forgets that the very first step already handles two elements. Seven is what you get by stopping when the block reaches eight, and four comes from pairing the elements off as though the machine swapped ends.
Answer: B) 8

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

An arrangement machine reshuffles an input line by reversing a block of elements at the…An arrangement machine reshuffles an input line by reversing a block of elements at the…An arrangement machine reshuffles an input line by reversing a block of elements at the…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,…