Algorithm: Selection Sort

Goal: Sort an array of numbers in ascending order using the Selection Sort technique.

Steps:

  1. Start
  2. Input n (number of elements in the array).
  3. Input the array arr[0…n-1].
  4. Fori = 0 to n-2:
    • Set minIndex = i.
    • Forj = i+1 to n-1:
      • If arr[j] < arr[minIndex]:
        • Set minIndex = j.
    • If minIndex != i:
      • Swap arr[i] and arr[minIndex].
  5. Print the sorted array.
  6. Stop

Flowchart: Selection Sort

पुढे वाचा

Algorithm: Insertion Sort

Algorithm: Selection Sort

Algorithm: Bubble Sort

Algorithm: Binary Search

Algorithm and flowchart to Search a particular data from the given Array of numbers using: Linear Search Method.

Leave a comment