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: 47 log 96 12 93 thunder kit bead
Step I: bead 47 log 12 93 thunder kit 96
Step II: bead kit 47 log 12 thunder 93 96
Step III: bead kit log 12 thunder 47 93 96
Step IV: bead kit log thunder 12 47 93 96
Step IV is the last step of this input.
Input: 38 37 storm quail 21 vine 69 web
Following the same rule, which of the following will be Step II for this input?
Answer & explanation
Correct answer: option 4
The correct answer is Option (4) → quail storm 37 21 vine web 38 69
Compare each step of the illustration with the one before it. In each step, the largest of the numbers not yet arranged moves to the next place from the right end, and the word that comes first in dictionary order among the words not yet arranged moves to the next place from the left end, both in the same step; the others keep their order.
Step I: ‘bead’ (first in dictionary order among the words left) moves to the first place from the left, and 96 (the largest number left) moves to the first place from the right
Step II: ‘kit’ (first in dictionary order among the words left) moves to the second place from the left, and 93 (the largest number left) moves to the second place from the right
Step III: ‘log’ (first in dictionary order among the words left) moves to the third place from the left, and 47 (the largest number left) moves to the third place from the right
Step IV: ‘thunder’ (first in dictionary order among the words left) moves to the fourth place from the left, and 12 (the largest number left) moves to the fourth place from the right
After Step IV every one of the words and numbers is in its final place, so the arrangement is complete.
Apply the same rule to the input 38 37 storm quail 21 vine 69 web.
Step I: ‘quail’ (first in dictionary order among the words left) moves to the first place from the left, and 69 (the largest number left) moves to the first place from the right, giving quail 38 37 storm 21 vine web 69
Step II: ‘storm’ (first in dictionary order among the words left) moves to the second place from the left, and 38 (the largest number left) moves to the second place from the right, giving quail storm 37 21 vine web 38 69
So Step II is quail storm 37 21 vine web 38 69.
Why the other options are incorrect
Option (1) quail 37 storm 21 vine web 38 69 — Incorrect. Only 38 has moved; in the same step ‘storm’, first in dictionary order among the words left, must go to the second place from the left.
Option (2) quail storm 38 37 21 vine web 69 — Incorrect. Only ‘storm’ has moved; in the same step 38, the largest of the numbers left, must go to the second place from the right.
Option (3) quail 38 37 storm 21 vine web 69 — Incorrect. This is Step I; in Step II ‘storm’ and 38 must also move.