Question

why are string sorts stable in data structures and algorithms

why are string sorts stable in data structures and algorithms

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

Sorting refers to arranging data in a particular format .In stable sorting, after sorting the contents, it does not change the sequence of similar content in which they appear.For many sorting applications, the keys that define the order are strings.Strings have a special properties to develop sorts for string keys that are more efficient than the general purpose sorts.There are fundamentally two approaches to string sorting.These are LSD(Least Significant Digit) and MSD(Most Significant Digit).

LSD---This method examines the characters in the keys in a right-to-left order.This method treats of a string as a base-256 number, considering characters from right to left amounts to considering first the least significant digits. This approach is the method of choice for string-sorting applications where all the keys are the same length.

MSD--This method examines the characters in the keys in a left-to-right order, working with the most significant character first. MSD string sorts are effective because they can get a sorting job done without necessarily examining all of the input characters.

By using the two approaches(LSD and MSD) String sort algorithms maintain the relative order of records with equal keys.That is equivalent elements retain their relative position after sorting.So we can say that string sorts are stable in data structures and algorithms.

Add a comment
Know the answer?
Add Answer to:
why are string sorts stable in data structures and algorithms
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