Question

Please answer only if you are sure and make it clear to understand. Do not make...

Please answer only if you are sure and make it clear to understand. Do not make it too long and complicated. Thank you in advance.

"Give an example of showing that quicksort is not a stable sorting algorithm".

0 0
Add a comment Improve this question Transcribed image text
Answer #1

When we consider example as key value pairs like (3, 1),(2,1), (2,2), (5,2) and sort on the basis of x, we can see that the quicksort doesn't maintain the order of (2,1) and (2,2).

Output by quicksort : (2,2), (2,1), (3,1), (5,2)

Stable algorithm : (2,1), (2,2), (3,1), (5,2)

Add a comment
Know the answer?
Add Answer to:
Please answer only if you are sure and make it clear to understand. Do not make...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT