consider sorting nn numbers stored in array aa by first finding the smallest element of aa and exchanging it with the element in a[1]a[1]. then find the second smallest element of aa, and exchange it with a[2]a[2]. continue in this manner for the first n-1n−1 elements of aa. write pseudocode for this algorithm, which is known as selection sort. what loop invariant does this algorithm maintain? why does it need to run for only the first n-1n−1 elements, rather than for all nn elements? give the best-case and worst-case running times of selection sort in \thetaθ-notation.