edited by
261 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.
edited by

Please log in or register to answer this question.

Related questions

1 votes
1 votes
1 answer
1
radha gogia asked Jul 16, 2015
812 views
I am not getting which algorithm has minimum no of swap operations , acc to me both selection and insertion should be at the lowest level as well as merge sort since afte...
0 votes
0 votes
1 answer
2
Doraemon asked Jun 5, 2019
351 views
What is swap space in secondary memory?
0 votes
0 votes
2 answers
3
KISHALAY DAS asked Nov 12, 2016
2,413 views
1 votes
1 votes
2 answers
4
srestha asked Sep 28, 2015
561 views
Swap space is some space in virtual memory. but why it called as swap space?