Ask Question
27 April, 09:41

Show the steps of a Selection Sort for the numbers (5 3 9 5).

+4
Answers (1)
  1. 27 April, 13:41
    0
    Sorted array will be:-

    3 5 5 9

    Explanation:

    In Selection Sort algorithm it sorts the array by repeatedly finds the minimum in the array form the array that is unsorted and swaps it with the value at the first position.

    The unsorted array: - 5 3 9 5

    In first iteration

    minimum is 3.

    3 will be swapped with 5.

    Now the array is 3 5 9 5

    sorted array 3

    In second iteration

    unsorted array is 5 9 5

    sorted array 3 5

    and the minimum from it is 5

    No swapping will occur.

    In third iteration

    unsorted array is 9 5

    minimum is 5

    sorted array 3 5 5

    swap it with 9.

    Now the array is sorted.

    3 5 5 9
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Show the steps of a Selection Sort for the numbers (5 3 9 5). ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers