A number arrangement machine, when given an input line of numbers, rearranges them step by step following a particular rule. An illustration of an input and its rearrangement is given below.
Input: 71 54 29 97 36 19 63
Step I: 19 54 29 97 36 71 63
Step II: 19 29 54 97 36 71 63
Step III: 19 29 36 97 54 71 63
Step IV: 19 29 36 54 97 71 63
Step V: 19 29 36 54 63 71 97
Step V is the last step of this input.
Input: 42 59 80 24 84 12 38
Following the same rule, which step for this input will be: 12 24 38 42 59 84 80?
Answer & explanation
Correct answer: option 4
The correct answer is Option (4) → Step V
Compare each step of the illustration with the one before it. In each step, the smallest of the numbers not yet arranged changes places with the number standing in the next place from the left; no other number moves.
Step I: 19 is the smallest of the numbers left; it changes places with 71, the number in the first place from the left
Step II: 29 is the smallest of the numbers left; it changes places with 54, the number in the second place from the left
Step III: 36 is the smallest of the numbers left; it changes places with 54, the number in the third place from the left
Step IV: 54 is the smallest of the numbers left; it changes places with 97, the number in the fourth place from the left
Step V: 63 is the smallest of the numbers left; it changes places with 97, the number in the fifth place from the left
After Step V the numbers stand from the smallest to the largest, so the arrangement is complete.
Apply the same rule to the input 42 59 80 24 84 12 38 until the given line appears.
Step I: 12 is the smallest of the numbers left; it changes places with 42, the number in the first place from the left, giving 12 59 80 24 84 42 38
Step II: 24 is the smallest of the numbers left; it changes places with 59, the number in the second place from the left, giving 12 24 80 59 84 42 38
Step III: 38 is the smallest of the numbers left; it changes places with 80, the number in the third place from the left, giving 12 24 38 59 84 42 80
Step IV: 42 is the smallest of the numbers left; it changes places with 59, the number in the fourth place from the left, giving 12 24 38 42 84 59 80
Step V: 59 is the smallest of the numbers left; it changes places with 84, the number in the fifth place from the left, giving 12 24 38 42 59 84 80
The line 12 24 38 42 59 84 80 is Step V.