Selection Sort is like a choosy person picking the best apples. It scans the unsorted section, selects the smallest item, and places it at the correct position. This process repeats until the entire list is sorted. Selection sort minimizes the number of swaps needed compared to Bubble Sort, which makes it useful when the cost of moving items is high, but finding the smallest item is easy.
for i = 0 to (n - 1):
min = i
for j = i + 1 to (n):
if arr[j] < arr[min]:
min = j
if min != i:
swap(i, min)