Computer Science, asked by kksowgandika533, 1 year ago

Select the appropriate pseudocode that performs selection sort

Answers

Answered by harpalsingh000177
1

Answer:

Explanation:

procedure for selection sort  

Aarry of items: List

Size : n

/* Initiating for loop */

  for i = 1 to n - 1

/* set starting element as minimum*/

     min = i  

 

 /* checking minimum element */

 for j = i+1 to n  

        if list[j] < list[min] then

           min = j;

        end if

     end for

/* end of for statement */

 /* now swaping the minimum element with the current element*/

     if indexMin != i  then

        swap list[min] and list[i]

     end if

  end for

/* end of for */

 

end procedure

/* end of procedure */

Answered by qwtiger
0

Answer:

The pseudo code of selection sort is given below, there can be more than one pseudocodes but i think this will work.

procedure selection sort  

  list  : array of items

  k    : size of list

  for i = 1 to n - 1

  /* set current element as minimum*/

     min = i    

 

     /* check the element to be minimum */

     for j = i+1 to k

        if list[j] < list[min] then

           min = j;

        end if

     end for

     /* swap the minimum element with the current element*/

     if indexMin != i  then

        swap list[min] and list[i]

     end if

  end for

 

end procedure

Similar questions