(Solved) : 1 6 Points Following Pseudo Code Shows Implementation Selection Sort Algorithm 1 Function Q43918494 . . .
1. (6 points) The following pseudo code shows an implementation of the selection sort algorithm. 1: function SELECTION-SORT 2: for i=1 to n-1 do min ti for j=i+1 to n do if A[j] < A[min] then minj end if end for swap A[i], A[min] 10: end for 11: end function # ☺ ☺ ☺ ☺ ☺ (a) Compute the worst case running time using the method shown in class for insertion sort. That is, assign a different constant to each of the lines 2-10 and use them to compute the running time. (b) Repeat part (a) for the best case running time. (c) Use the O-notation to compare the worst-case and best-case running times computed above to the following functions n, nlgn, and n?. (d) Compare the worst and best case running times of the selection sort to the corresponding times of the insertion sort using one of the three notations, o, o, or w.. Show transcribed image text 1. (6 points) The following pseudo code shows an implementation of the selection sort algorithm. 1: function SELECTION-SORT 2: for i=1 to n-1 do min ti for j=i+1 to n do if A[j]
Expert Answer
Answer to 1. (6 points) The following pseudo code shows an implementation of the selection sort algorithm. 1: function SELECTION-S…
OR