retagged by
1,899 views
0 votes
0 votes
We have a list of pairs [("Tariq",71),("Brinda",85),("Shweta",71),("Sunita",85),("Salma",72),("Uday",60)], where each pair consists of a student's name and his/her marks in a course. We sort these pairs in ascending order of marks. Which of the folllowing corresponds to a stable sort of this input?

1. [("Uday",60),("Tariq",71),("Shweta",71),("Salma",72),("Brinda",85),("Sunita",85)]

2. [("Brinda",85),("Salma",72),("Shweta",71),("Sunita",85)("Tariq",71),("Uday",60)]

3. [("Uday",60),("Shweta",71),("Tariq",71),("Salma",72),("Brinda",85),("Sunita",85)]

 4.[("Uday",60),("Tariq",71),("Shweta",71),("Salma",72),("Sunita",85),("Brinda",85)]
retagged by

1 Answer

0 votes
0 votes
Option a is correct

An algorithm is said to be stable if two objects with equal keys appear in the same order as in the input unsorted array...

Only option a satisfy this....
Answer:

Related questions

0 votes
0 votes
1 answer
3
saurabh12345 asked Jul 24, 2018
419 views
Insertion sort uses an incremental approach for designing algorithm can someone please explain?
0 votes
0 votes
1 answer
4
iamdeepakji asked Oct 2, 2018
335 views
What is adaptive algorithm and is merge sort and quick sort is adaptive?