Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Discovering Knowledge In Data An Introduction To Data Mining

Authors: Daniel T. Larose, Chantal D. Larose

2nd Edition

0470908742, 978-0470908747

More Books

Students also viewed these Programming questions