Question:

From one sequence of digits, another sequence of digits has to be formed as per the following rule:
Single switch: interchange of any two adjacent digits, where one such interchange counts as one step.

Using only single switching, what is the minimum number of steps required to change 51432 to 12345?

Show Hint

Count how many pairs of digits are out of their final relative order. That count is the minimum number of adjacent swaps needed.
Updated On: Jul 15, 2026
  • 6
  • 7
  • 8
  • 9
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Step 1: Understand what a single switch can do.
A single switch only swaps two digits that are sitting right next to each other. This is exactly the operation used in bubble sorting, so the minimum number of single switches needed equals the number of adjacent swaps a bubble sort would use to arrange the digits in order.

Step 2: Bring the 1 to the front.
Start with 5 1 4 3 2. The digit 1 is already next to the front, so one swap of positions 1 and 2 gives 1 5 4 3 2. (1 step so far)

Step 3: Move the 2 into position.
From 1 5 4 3 2, the digit 2 sits at the last place and needs to reach the second place, three places to its left. Swap it one step left at a time:
1 5 4 2 3
1 5 2 4 3
1 2 5 4 3
That takes 3 more swaps. (4 steps so far)

Step 4: Move the 3 into position.
From 1 2 5 4 3, the digit 3 sits at the last place and needs to reach the third place, two places to its left:
1 2 5 3 4
1 2 3 5 4
That takes 2 more swaps. (6 steps so far)

Step 5: Finish the order.
From 1 2 3 5 4, one last swap of the 5 and 4 gives 1 2 3 4 5. (7 steps in total)

Final Answer:
The minimum number of single switch steps needed is 7. \[ \boxed{7} \]
Was this answer helpful?
0
0