Question: Using Big-O where the n term is as small as possible... = (b) Consider the following 3 functions: i. Procedure: FindAAD(X, n) Set: M =
Using Big-O where the n term is as small as possible...
= (b) Consider the following 3 functions: i. Procedure: FindAAD(X, n) Set: M = FindMedian(X,n) Set: sum= 0 for i in 1 to n: do Set: sum = sum + ]X[i] M| end for Return: sum . Procedure: FindMADGood(X, n) Set: M FindMedian(X,n) Initialize vector Y of length n for i in 1 to n: do Set: Y [j] = |x[i] - M end for Return: FindMedian(Y,n) iii. Procedure: FindMADBad(X, n) Initialize vector Y of length n for i in 1 to n: do Set M = FindMedian(X,n) Set: Y[i] = [X[] M| end for Return: FindMedian(Y,n) What are the asymptotic runtimes of FindAAD, FindMADGood(X, n), and FindMADBad(X, n)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
