Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is stable sorting?

Sorting STABLE
0
Posted

What is stable sorting?

0

Location: http://www.jguru.com/faq/view.jsp?EID=225366 Created: Oct 9, 2000 Modified: 2005-08-15 12:58:19.757 Author: Avi Kak (http://www.jguru.com/guru/viewbio.jsp?EID=26410) The collections framework specification requires that the sorting algorithms be stable. Stated succinctly, a sorting algorithm is stable if it does not reorder equal elements. But what does that really mean? The goal of this posting is to illustrate this concept. Stability in sorting becomes an issue for class-type objects with two or more data members. We’d obviously need to choose a data member whose values will be used to order the objects for sorting. Let’s say we have multiple objects in a list whose values for the data member chosen for comparison are the same, but whose values for the other data members are different. A stable sorting algorithm will leave the original order of such objects untouched. Stability in sorting, or lack thereof, is best illustrated by comparing the sorted order obtained through t

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123