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
Since the device is sorting the number in descending order with biggest number and one at a time.
For Input 16 09 25 27 06 05
Step I :Â 27Â 16 09 25Â 06 05
Step IIÂ :Â 27 25Â 16 09 06 05
After which all the numbers are sorted. Hence 2 steps are needed
Create a FREE account and get: