A machine rearranges numbers in each step.
Input: 45, 12, 78, 36, 59.
Step 1: 12 moves to first and 78 to last.
Step 2: 36 moves to second and 59 to fourth.
If the pattern continues, what will be the final output?
Show answer & explanation
Correct answer: A
Explanation
The machine rearranges the numbers in ascending order from both ends simultaneously:
• In each step, the smallest remaining number moves to the leftmost available position, and the largest remaining number moves to the rightmost available position.
Input: 45, 12, 78, 36, 59
• Step 1: 12 (smallest) moves to the 1st position and 78 (largest) moves to the last position.
→ 12, 45, 36, 59, 78
• Step 2: 36 (next smallest) moves to the 2nd position and 59 (next largest) moves to the 4th position.
→ 12, 36, 45, 59, 78
Since the middle number 45 is already in its correct sorted position, the final output is 12, 36, 45, 59, 78.
Therefore, the correct option is (A).