Start learning 50% faster. Sign in now
Here the rule followed is: numbers are getting arranged in ascending order. The smallest no. interchanges with the first position. Then the largest no. interchanges with the last position. Next, the second smallest no. interchanges with the second position. And so on. Input: 76 172 372 43 243 361 165 Step I: 43 172 372 76 243 361 165 Step II: 43 172 165 76 243 361 372 Step III: 43 76 165 172 243 361 372 [Machine will stop after step III.]