Question: e an algorithm to find the maximum element in an unsorted array many comparisons are done in the best case? 1) a) Writ ci How

e an algorithm to find the maximum element in an unsorted array many comparisons are done in the best case? 1) a) Writ ci How many comparisons are done in the average case? d) How many comparisons are done in the worst case? 2) Do the same as part 1) for the minimum of an array a) Write an algorithm that find the maximum and the minimum of an array. b) How many comparisons are done in the worst case? c) Can you do better? (1.5n is the best), a) Write an algorithm that finds the maximum and the 2-nd maximum. b) How many comparisons are done in the worst case? c) Can you do better? 4) a) Think of a way to find the median of an unordered array b) About how many comparisons will have to be done? 5)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
