in Algorithms edited by
204 views
0 votes
0 votes
There are n students standing in a line. The students have to rearrange themselves in ascending order of their roll numbers. This rearrangement must be accomplished only by successive swapping of adjacent students.

(i) Design an algorithm for this purpose that minimises the number of swaps required.

(ii) Derive an expression for the number of swaps needed by your algorithm in the worst case.
in Algorithms edited by
204 views

1 comment

as I know you should apply selection sort because no of swap is less as compare to other
0
0

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
2
0 votes
0 votes
2 answers
3
KISHALAY DAS asked in DS Nov 12, 2016
1,950 views
KISHALAY DAS asked in DS Nov 12, 2016
2.0k views
1 vote
1 vote
2 answers
4