Discussion of Question with ID = 035 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

"30 19 68 01 07 34 54 26" is re-arranged according to a particular rule, in the steps mentioned below.

  1. 01 19 68 30 07 34 54 26
  2. 01 19 26 30 07 34 54 68
  3. 01 07 26 30 19 34 54 68
  4. 01 07 19 30 26 34 54 68
  5. 01 07 19 26 30 34 54 68

If an input is: 10 34 57 62 28 04 93 01, then how many steps are required if re-arrangement is done according to the above rule?

A

7

B

6

C

9

D

8

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 10 34 57 62 28 04 93 01:

  1. 01 34 57 62 28 04 93 10
  2. 01 34 57 62 28 04 10 93
  3. 01 04 57 62 28 34 10 93
  4. 01 04 57 10 28 34 62 93
  5. 01 04 10 57 28 34 62 93
  6. 01 04 10 34 28 57 62 93
  7. 01 04 10 28 34 57 62 93

Comments and Discussion