Write a counted selection-sort function

Write selection_sort(int a[], int n, int counts[2]) for ascending integer order. counts[0] must receive the number of a[j]<a[min] comparisons and counts[1] the number of actual exchanges between different indices; use the first minimum when equal values occur. The caller supplies 0<=n<=8 and n values in [-100,100]. Write a complete program that reads that input and prints sorted: followed by each value prefixed with one space, then a line comparisons=C swaps=S. Empty input data must produce sorted: with no following space. Explain why n=0 and n=1 are safe and derive the comparison count for general n>=1.


