logoSEE ALGORITHMS
Sorting
    Bubble Sort
    Insertion Sort
    Selection Sort
    Radix Sort
    Heap Sort
    Merge Sort
    Quick Sort
    Depth First Search
    Breadth First Search
    Prim's Algorithm
    Kruskal's Algorithm
    Dijkstra's Algorithm
    Topological Sorting
    Hamiltonian Cycle
    Binary Search Tree
    Binary Heap
    Circular Queue
    Convex Hull
    Huffman Coding
Selection Sort

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)
Select number of elements: