Discussion of Question with ID = 052 under Passwords-and-Inputs

This is the discussion forum for this question. If you find any mistakes in the solution, or if you have a better solution, then this is the right place to discuss. A healthy discussion helps all of us, so you are requested to be polite and soft, even if you disagree with the views of others. The question and its current solution has also been given on this page.

Advertisement

Question

"04 90 57 83 84 17 33 14" is re-arranged according to a particular rule, in the steps mentioned below.

  1. 04 14 57 83 84 17 33 90
  2. 04 14 57 83 33 17 84 90
  3. 04 14 17 83 33 57 84 90
  4. 04 14 17 57 33 83 84 90
  5. 04 14 17 33 57 83 84 90

If an input is: 12 48 29 20 03 23 72 04, then how many steps are required if re-arrangement is done according to the above rule?

A

5

B

4

C

7

D

6

Soln.
Ans: a

In each step, the smallest numbers are being moved to the left, and in the next step largest to the right side. These are the steps for re-arrangement starting with 12 48 29 20 03 23 72 04:

  1. 03 48 29 20 12 23 72 04
  2. 03 48 29 20 12 23 04 72
  3. 03 04 29 20 12 23 48 72
  4. 03 04 12 20 29 23 48 72
  5. 03 04 12 20 23 29 48 72

Comments and Discussion