edited by
1,341 views
0 votes
0 votes

The algorithm that will efficiently sort an array that is nearly sorted except for the interchange of some adjacent pairs of numbers like $\left \{ 1, 3, 2, 5, 4, 6\right \}$ is :

  1. Quick sort
  2. Bubble sort
  3. Merge sort
  4. Selection sort
edited by

2 Answers

1 votes
1 votes
should it be B
0 votes
0 votes
In Bubble sort, we compare the adjacent elements and exchange them if they are not in proper order. Since the given array is almost sorted and we require few exchanges here. so bubble sort is the best choice.

Option B is correct here.

Related questions

0 votes
0 votes
1 answer
2
0 votes
0 votes
1 answer
3
go_editor asked Mar 26, 2020
559 views
Consider the relation on the set of non-negative integers defined by $x \equiv y$ if and only if:$x$ $\text{mod}$ $3=3$ $\text{mod}$ $y$$3$ $\text{mod}$ $x \equiv 3$ $\te...
0 votes
0 votes
2 answers
4
go_editor asked Mar 26, 2020
1,485 views
Minimum number of individual shoes to be picked up from a dark room ( containing $10$ pair of shoes) if we have to get atleast one proper pair :$2$$20$$11$None of these