Menu

(Solved) : 7 10 Points Consider Sorting Program C 1 Void Sorting Int Arr Int N 2 Int J K Temp 3 4 0 Q44016713 . . .

7. (10 points) Consider a sorting program in C++. 1. void my sorting (int arr[], int n) 2. { int i, j, k, temp; 3. i 4. 0; wh

7. (10 points) Consider a sorting program in C++. 1. void my sorting (int arr[], int n) 2. { int i, j, k, temp; 3. i 4. 0; while (i < n-1) 5. 6. { i; 7. i+1; 8. while (j < n) 9. 10. { if (arr[j] < arr[k]) 11. 12. { j; 13. k 14. } 15. j+1; 16. 17. arr[k]; temp = arr[i]; = temp; 18. arr[k] 19. arr[i] i = i+1; 20. 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. Show transcribed image text 7. (10 points) Consider a sorting program in C++. 1. void my sorting (int arr[], int n) 2. { int i, j, k, temp; 3. i 4. 0; while (i

Expert Answer


Answer to 7. (10 points) Consider a sorting program in C++. 1. void my sorting (int arr[], int n) 2. { int i, j, k, temp; 3. i 4. …

OR