Computer Science, asked by kamalrajatjoshi94, 1 month ago

Explain the logic.It is selection sort.​

Attachments:

Answers

Answered by BrainlyFlash
2

{\huge{\star{\underbrace{\tt{\red{Answer}}}}}}{\huge{\star}}

Selection sort

Selection sort is an in-place comparison sort for sorting in ascending order unless specified otherwise. Selection sort is noted for its simplicity, and also has performance advantages over more complicated algorithms, in certain situations.

The algorithm finds the minimum value, swaps it with the value in the first position, and repeats these steps for the remainder of the list. It does no more than n swaps on small data.

It make sorting inefficient on large lists.

Effectively , the list is divided into two parts :

  • The sublist of items already sorted, which is built up from left to right and is found at the beginning.
  • The sublist of items remaining to be sorted, occupying the remainder of the array.

Algorithm

The algorithm works as follows :

  1. Find the minimum value in the list.
  2. Swap it with the value in the first position.
  3. Repeat the steps above for the remainder of the list (starting at the second position and advancing down the list each time).

Here is an example of the selection sort algorithm for following five elements : 64 , 5 , 12 , 22 , 11

 \\

11 25 12 22 64

11 12 25 22 64

11 12 22 25 64

11 12 22 25 64

11 12 22 25 64

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

Hope it's help

Please mark me as brainliest (๑╹◡╹๑)

# ICSE student here...

Similar questions