Hi I need help with this questions relating to c++ Thank you and have a great day!

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Hi I need help with this questions relating to c++ Thank you and have a great day!

Post by answerhappygod »

Hi I need help with this questions relating to c++
Hi I Need Help With This Questions Relating To C Thank You And Have A Great Day 1
Hi I Need Help With This Questions Relating To C Thank You And Have A Great Day 1 (24.68 KiB) Viewed 56 times
Hi I Need Help With This Questions Relating To C Thank You And Have A Great Day 2
Hi I Need Help With This Questions Relating To C Thank You And Have A Great Day 2 (24.83 KiB) Viewed 56 times
Hi I Need Help With This Questions Relating To C Thank You And Have A Great Day 3
Hi I Need Help With This Questions Relating To C Thank You And Have A Great Day 3 (25.43 KiB) Viewed 56 times
Hi I Need Help With This Questions Relating To C Thank You And Have A Great Day 4
Hi I Need Help With This Questions Relating To C Thank You And Have A Great Day 4 (12.4 KiB) Viewed 56 times
Hi I Need Help With This Questions Relating To C Thank You And Have A Great Day 5
Hi I Need Help With This Questions Relating To C Thank You And Have A Great Day 5 (14.26 KiB) Viewed 56 times
Thank you and have a great day!
Question 1 1 pts Suppose you are collecting performance data for the selection sort shown below, and you collect elapsed times and graph those times. What trend would you expect the graph to show? void selection_sort(int a[], int size) { int next; for (next = 0; next < size - 1; next++) { int before = time(); int min_pos = min_position(a, next, size - 1); int after = time(); cout << (after - before) << endl; if (min_pos != next) { swap(a[min_pos), a[next]); } } } Constant time Linear Log Quadratic

Question 2 1 pts Suppose you are collecting performance data for the selection sort shown below, and you collect elapsed times as shown and graph those times. What trend would you expect the graph to show? 1); void selection_sort(int a[], int size) { int next; for (next = 0; next < size - 1; next++) int min_pos = min_position(a, next, size - if (min_pos != next) { int before = time(); swap(a[min_pos], a[next]); int after = time(); cout << (after - before) << endl; } } } Constant time Linear Log Quadratic

Question 3 1 pts Suppose you want to write an algorithm to find the most frequent element in a vector. The brute force method takes O(n?) time, examining every element and counting the number of occurences for that value. Optimizing the algorithm to not re-examine already tested parts of the vector reduces it to O(n²/2), because each value requires searching one fewer elements. What is that pattern called? Linear Triangle Quadratic Log

Question 4 1 pts = Suppose the time for an algorithm on an array of size n is T(n) = an2 + bn + c. What type of algorithm is it? Linear Triangle Quadratic Log

Question 5 1 pts Suppose an algorithm cuts the amount of work in half at each step, such as processing half an array, then half of that half, etc... What type of algorithm is it? Linear Triangle Quadratic Log
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply