
Stable sorting
Stable sorting is a method of organizing data where items with the same value stay in the same order as they were originally arranged. For example, if you sort a list of students by grade but want to keep the original order of students with the same grade, a stable sort ensures their initial order remains unchanged. This is important when multiple sorting criteria are used or when maintaining the context of data is necessary. Stable sorting helps preserve relationships within data, making it more reliable for complex tasks.