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
Insertion Sort

Ever organized a hand of playing cards? Then you already know Insertion Sort! This algorithm takes each element from the unsorted part and slides it into its correct position in the sorted part. It is like placing a new card in the right spot of a sorted hand, making it intuitive and efficient for small dataset, especially for partially sorted lists.

    for i = 1 to (n - 1):
        key = arr[i]
        j = i - 1
        while j >= 0 and arr[j] > key:
            arr[j + 1] = arr[j]
            j = j - 1
        arr[j + 1] = key
Select number of elements: