Question: 3. 4. 5. 7. (10 points) Consider a sorting program in C++. 1. void my_sorting (int arr[], int n) 2. { int i, j,

3. 4. 5. 7. (10 points) Consider a sorting program in C++. 1. void my_sorting (int arr[], int n) 2. { int i, j, k, temp; i = 0; while (i < n-1) 6. { 7. k = i; 8. j = i+1; 9. 10. { 11. 12. 3 13. 14. while (j < n) if (arr[j] < arr[k]) } k = j; 15. j = j+1; 16. } 17. temp = arr[k]; 18. arr[k] = arr[i]; 19. arr[i] = temp; 20. i =i+1; 21. } 22. } (a) Present the basic operation of the program. In your answer, you should also present the line number of the basic operation clearly. (b) Present the time complexity of the algorithm in the O notation.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
