- Tag · selection-sort-

2020

This article provides a comprehensive overview of Selection Sort, a simple comparison-based sorting algorithm. We explore its core steps - iterating to find the minimum element in the unsorted portion of a list and swapping it into its correct sorted position. The analysis details why Selection Sort is $O(n^2)$ time complexity for both average and worst cases due to nested loops, requiring minimal $O(1)$ extra space. We also explain why it is classified as an unstable sorting algorithm, demonstrated by a clear example where the relative order of equal elements is not preserved. A corrected Java implementation is included.