Question: Please help me with this question! 1. Suppose that Procedurel(n) runs in O(n) time for any n 2 1 and Procedure2(n) runs in O(n2) time.
Please help me with this question!
1. Suppose that Procedurel(n) runs in O(n) time for any n 2 1 and Procedure2(n) runs in O(n2) time. Analyze the runtime for each algorithm. You may use the Master Theorem if it applies. Your answer should be in Big-O notation. (a) (3 points) Alg a(n) 1. if n- 1 then 2. return 3. Procedurel(n) 4. Alg-a(n/2) 5. Alg -a(n/2) 6. Alg a(n/2) (b) (3 points) Alg b(n) 1. if n- 1 then 2. return 3. Procedure2(n) 4. Alg b(n/3) 5. Alg-b(n/3) 6. Alg-b(n/3) 7. Alg b(n/3) (c) (4 points) Alg-c(n) 1, if n= 1 then 2. return 3. Alg.c(n -1) 4. Alg c(n -1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
