Question: SELECTION - SORT ( A ) 1 for i = 1 to A . length - 1 2 minIndex = i 3 for j =

SELECTION-SORT (A)
1 for i =1 to A.length -1
2
minIndex = i
3
for j = i +1 to A.length
4
if A(i)< A(minIndex and j minIndex
5
minIndex = j
6
swap Ai] with A(minIndex]
From the following, select the option that represents a ture statement for this algorithm.
a. The time complexity of the given algorithm is always (n?).
b. The loop invariant for the algorithm is: The subarray A[1(i-1)] is norted in non-decreasing order.
O c. The best case scenario time complexity for the given algorithm is e(n).
d. None of the above.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!