What is the number of swaps required to sort $n$ elements using selection sort, in the worst case?
$\Theta(n \log n)$
$\Theta(n^2 \log n)$
The answer is A.
we have $1$ swap in each loop and hence $n$ swaps at max for $1$ to $n$. Therefore the worst case number of swaps is $\Theta(n)$
@reena ma'am, it depends on implementation, but in its basic form, even in best case selection sort requires 1 swap in each pass. https://stackoverflow.com/questions/26688765/what-are-the-number-of-swaps-required-in-selection-sort-for-each-case
First of all, congratulations!
Please elucidate this really important...