When a line of words and numbers is fed into a machine, the machine rearranges it step by step following a particular rule. An illustration of an input and its rearrangement is given below.
Input: tart jam 24 77 bun 61 pie 31
Step I: bun tart jam 24 77 61 pie 31
Step II: bun 24 tart jam 77 61 pie 31
Step III: bun 24 jam tart 77 61 pie 31
Step IV: bun 24 jam 31 tart 77 61 pie
Step V: bun 24 jam 31 pie tart 77 61
Step VI: bun 24 jam 31 pie 61 tart 77
Step VI is the last step of this input.
Input: roof hall arch gate 28 76 33 52
Following the same rule, in Step III for this input, which element will be second to the right of ‘roof’?
Answer & explanation
Correct answer: option 2
The correct answer is Option (2) → 76
Compare each step of the illustration with the one before it. Words and numbers are placed by turns from the left end: in Steps I, III, V, ... the word that comes first in dictionary order among the words left, and in Steps II, IV, VI, ... the smallest of the numbers left, moves to the next place; the others keep their order.
Step I: ‘bun’ comes first in dictionary order, so it moves to the first place from the left
Step II: 24 is the smallest of the numbers left, so it moves to the second place from the left
Step III: ‘jam’ comes first in dictionary order, so it moves to the third place from the left
Step IV: 31 is the smallest of the numbers left, so it moves to the fourth place from the left
Step V: ‘pie’ comes first in dictionary order, so it moves to the fifth place from the left
Step VI: 61 is the smallest of the numbers left, so it moves to the sixth place from the left
After Step VI words and numbers come by turns, the words in dictionary order and the numbers from the smallest to the largest, so the arrangement is complete.
Apply the same rule to the input roof hall arch gate 28 76 33 52.
Step I: ‘arch’ comes first in dictionary order, so it moves to the first place from the left, giving arch roof hall gate 28 76 33 52
Step II: 28 is the smallest of the numbers left, so it moves to the second place from the left, giving arch 28 roof hall gate 76 33 52
Step III: ‘gate’ comes first in dictionary order, so it moves to the third place from the left, giving arch 28 gate roof hall 76 33 52
In Step III, arch 28 gate roof hall 76 33 52, counting to the right of ‘roof’: hall (first), 76 (second).
So the element second to the right of ‘roof’ is 76.