Topic: Algorithms / Sorting
A sorting algorithm is defined as stable if it:
- A. Uses O(1) auxiliary memory space
- B. Has O(n log n) worst-case time complexity
- C. Never executes recursive function calls
- D. Preserves relative order of equal keys
Answer: D. Preserves relative order of equal keys
Explanation: A sorting algorithm is considered stable if it preserves the relative original order of elements that have equal keys or values. For example, if two identical elements appear in a specific order in the unsorted input, they will remain in that exact same order in the sorted output.