Study the following example and answer the questions.
An electronic device rearranges numbers step-by-step in a particular order according to a set of rules. The device stops when the final result is obtained. In this case the device stops at Step V.
Input: 85 16 36 04 19 97 63 09
Step I - 97 85 16 36 04 19 63 09
Step II - 97 85 63 16 36 04 19 09
Step III - 97 85 63 36 16 04 19 09
Step IV - 97 85 63 36 19 16 04 09
Step V - 97 85 63 36 19 16 09 04
Which one of the following would be last step for the input below?
Input: 03 31 43 22 11 09
We see that in this, the number is sorted in the descending order in which every step the biggest number which is not in the correct place picked and placed at its place.
Input: 03 31 43 22 11 09
Step I = 43 03 31 22 11 09
Step II = 43 31 03 22 11 09
Step III = 43 31 22 03Â 11 09
Step IV = 43 31Â 22 11Â 03Â 09
Step V = 43 31 22 11 09 03
Total 5 steps are needed.
Create a FREE account and get: