Question: please answer all part a b and c . thanks Consider the following functions which both take as arguments three n-element artays A,B, and C.
Consider the following functions which both take as arguments three n-element artays A,B, and C. CoMeare-1 (A,B,C) For i=1 to n For j=1 to n If A[i]+C[i]B[j] Return FALSE Return TRUE Compxre-2 (A,B,C) aux:=A1+C1] For i=2 to n If A[v]+C[i]>aux Then aux:=A[i]+C[i] For y=1 to n If auxB[j] Return FALSE Return TRUE (a) When do these two functions return TMUE? (b) What is the worst-case running time for each function? (c) What is the best-case running time for each function? Your answers to parts (b)-(c) should follow the approach we used to analyze the time complexity of insertion sort in the lecture
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
