Sorting Algorithms.
sorted. Time and Space Complexity Analysis Time Complexity: Best Case: O(n²) — Since it doesn’t have any special cases, it performs at its worst even if the array is partially sorted. Worst Case: O(n²) — Same as the best case. Average Case: O(n²) — On average, selection sort requires n² comparisons