What will the fourth step for an input whose second step is given below?
Step: 678 42 183 289 523 78 110 350
678 42 523 78 183 289 110 350
From the last step, it is clear that there are two alternating series of numbers: One in descending order and the other in ascending order. When we go through:
Input to step 1, we find that the largest no. becomes the first and remaining numbers shift rightward. In the next step the smallest no. becomes the second and the rest shift rightward. These two steps continue alternately until the two alternate series are formed.