Question: SELECTION - SORT ( A ) 1 for i = 1 to A . length - 1 2 minIndex = i 3 for j =
SELECTIONSORT A
for i to Alength
minIndex i
for j i to Alength
if Ai AminIndex and j minIndex
minIndex j
swap Ai with AminIndex
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 Ai is norted in nondecreasing order.
O c The best case scenario time complexity for the given algorithm is en
d None of the above.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
