What should be the fourth step of the following input?
64 326 187 87 118 432 219 348
Explanation:
The output has the numbers arranged in the order:
smallest, largest, second smallest, second largest, third smallest, third largest and so on.
In the first step, the smallest number is moved to position 1 and the other numbers retain their relative positions.
In the second step, the largest number is moved to position 2 and the other numbers retain their positions.
This continues till the desired output is obtained.
The steps for the given input are:
Hence, option (c).
» Your doubt will be displayed only after approval.
Help us build a Free and Comprehensive Preparation portal for various competitive exams by providing us your valuable feedback about Apti4All and how it can be improved.