This article was automatically translated from the original Turkish version.
+1 More
Selection sort is a sorting algorithm that, in each iteration, selects the smallest element from the unsorted list and places it at the beginning of the unsorted portion.
Step 1: The first element of the array is assumed to be the minimum.
Step 2: The minimum is compared with the second element. If the second element is smaller than the minimum, it is assigned as the new minimum.
The minimum is then compared with the third element. If the third element is smaller, it becomes the new minimum; otherwise, no change is made. This process continues until the last element is reached.
Step 3: After each iteration, the identified minimum element is swapped with the first element of the unsorted portion.
Step 4: For each iteration, the indexing begins from the first unsorted element. Steps 1 and 3 are repeated until all elements are placed in their correct positions.
No Discussion Added Yet
Start discussion for "Selection Sorting Algorithm" article
Working Principle
Selection Sort Algorithm with Java Code