Question: Problem 2 (10 points) What does the following algorithm do? Analyze its complexity (5 points) then give another algorithm that produces exactly the same output

Problem 2 (10 points) What does the following algorithm do? Analyze its complexity (5 points) then give another algorithm that produces exactly the same output as the original one (5 points) and has better complexity. For example, what is the output when the A = [5, 12, 3, 8, 9, -1, 3, 15, 3, 71 and t = 3? Your algorithm should produce exactly the same output. Mystery1 (A[1..n), t) 1. i=1 2. while i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
