a) write pseudocode for an algorithm that sorts the list as follows:
Search for maximum and minimum elements in A[1.n]. Swap min with A[1] if they are different and swap max
with A[n] if they are different.
Search for maximum and minimum elements in A[2.n-1]. Swap min with A[2] if they are different and swap max
with A[n-1] if they are different.
Search for maximum and minimum elements in A[3.n-2]. Swap min with A[3] if they are different and swap max
with A[n-2] if they are different, and so on.
b)
What is the best case for this algorithm and what is its time complexity?
c) What is the worst case for this algorithm and what is its time complexity?
Fig: 1