\
  SelectionSort(A[],n)
    1.   For i = 0 to n - 2
    2.     min =i
    3.     For j =i+1 to n-1
    4.       If A[j] < A[min])
    5.         min = j
    6.     End For
    7.     swap A[min] <-> A[i];
|
|
Space | ||
| Best Case | Average Case | Worst Case | |
What is the working mechanism of Selection Sort ?
Selection sort is a simple sorting algorithm that sorts an array by repeatedly finding the minimum element from unsorted
part of the array and placing it at the beginning of the sorted part of the array.
Is selection sort a stable,
in-place sorting algorithm or an out-of-place sorting algorithm?
Selection sort is an unstable in-place algorithm, meaning that it does not require any extra space but can't maintain the relative order of duplicates.
How does the number of elements impact the efficiency of Selection sort?
The time complexity of selection sort is O(n^2), where n is the number of elements
in the array. This means that the efficiency of selection sort is directly impacted by the number of elements in the array.
As the number of elements increases, the time taken to sort the array using selection sort also increases.
What are advantages and disadvantages of Selection Sort?
Advantages: