Question: 3. [13 marks] Given the following sorting methods: template void sort(Elem A[], int n) { for (int i=0; i int lowindex = i; for (int
3.
[13 marks]
Given the following sorting methods:
template
void sort(Elem A[], int n) {
for (int i=0; i int lowindex = i; for (int j=n-1; j>i; j--) if ((A[j] if (lowindex != i) swap(A, i, lowindex); } } a) What is the name of the given function sort()? (2 marks) b) Given the unsorted list: 12, 4, 16, 8 and 20. By using the given sorting methods, write down the result of each iteration of outer for loop: (7 marks) i=0 i=1 i=2 i=3 12 4 4 8 16 12 8 16 20 20 c) Describe a sorting method which has a smaller Big-O than sort() in detail. (4 marks) ![3. [13 marks] Given the following sorting methods: template void sort(Elem A[],](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66d984bedc9e7_32666d984be7d7b9.jpg)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
