Question
What will be the last step for the following input?
Input: 172, 77, 49, 91, 90, 160, 41, 83 Directions : Study the following information carefully to answer the questions given below:A number sorting machine, when given an input of numbers, rearranges the numbers in a particular manner step by step as indicated below, till all the numbers are arranged in a particular order. Given below is an illustration of this arrangement. Input: 45, 163, 53, 19, 81, 139, 18, 48, 73, 96 Step I: 18, 45, 163, 53, 19, 81, 139, 48, 73, 96 Step II: 18, 45, 53, 19, 81, 139, 48, 73, 96, 163 Step III: 18, 19, 45, 53, 81, 139, 48, 73, 96, 163 Step IV: 18, 19, 45, 53, 81, 48, 73, 96, 139, 163 Step V: 18, 19, 45, 48, 53, 81, 73, 96, 139, 163 Step VI: 18, 19, 45, 48, 53, 73, 81, 96, 139, 163 (This is the final arrangement and VI is the last step for this input.)Solution
The following is the logic: Input to step I: The smallest no. comes to the leftmost position and the rest shift rightward. Step I to Step II: The largest no. comes to the rightmost position and the rest shift leftward. And thus we go on arranging the nos. on left and right alternately till the final arrangement is in ascending order. The last step will be the one arranged fully in ascending order.
Mouling National Park is located in which state?
What is the primary focus of the 'Wrestle for Glory' program launched by IndusInd Bank? Â
Which is India's 1 st state to Use Blockchain To Distribute Seed To Farmers?
...The $23 million loan agreement signed between India and ADB aims to establish an International Fintech Institute (IFI) in:
How much was the loan signed between India and ADB to support sustainable infrastructure projects?
Recently A new media company “Hana Kuma” has been launched by?
- Which country will host the Secretariat of the International Big Cat Alliance (IBCA)?
What amount is the cash prize associated with the Khel Ratna Award?
The Reserve Bank of India (RBI) is extending the deadline for card-on-file (CoF) tokenisation till ____________.
Vayana Network and __________ have been awarded the 'Most Effective Bank-Fintech Partnership: Agile and Adaptable' at the IBSi-Global Fintech Innovation...