Follow The Following Pseudo Code :
Procedure 1:
MIN(A, K, N, LOC)
An Array A is in memory. This procedure finds the location LOC of the smallest element among A[K], A[K+1],...,A[N]
Quote:
1. Set MIN :=A[K] AND LOC := K. [Initializes pointers.]
2. Repeat for J=K+1, K+2,...,N:
If MIN>A[J], then: Set MIN :=A[J] and LOC :=A[J] and LOC := J. [End of Loop]
3. Return
Procedure 2:
FUNCTION (A,N)
Quote:
1. Repeat Steps 2 and 3 for K=1,2,...,N-1:
2. Call MIN(A,K,N,LOC).
3. [Intrechange A[K] and A[LOC].]
Set TEMP := A[K], A[K]:=A[LOC] and A[LOC]:=TEMP.
[End of step 1 loop]
4. Exit.
What is the function of procedure 2?