Question: https://en.m.wikipedia.org/wiki/Geometric_mean Below is a snippet of code that relies on three methods: execA, execB, and execC. The worst, best, and average time complexity is given
https://en.m.wikipedia.org/wiki/Geometric_mean 
Below is a snippet of code that relies on three methods: execA, execB, and execC. The worst, best, and average time complexity is given for each of these functions. int exec = random.nextInt(6); switch(exec) { case 0: execA(n); // O(n*), Omega(log n), Theta(n) break; case 5: execB(n); // O(n), Omega(n), Theta(n) reak%3B default: execC(n); // O(n), Omega(n2), Theta(n*log n) } Please answer the following: 1. [2 marks] What is the worst case Big-O for this code? Justify your answer. 2. [2 marks ] What is the best case Omega? Justify your answer. 3. [1 marks] Estimate average case Theta using your answer from 1 and 2. 4. [1 mark ] For answering question 3 you probably assumed an arithmetic mean (an average you are most familiar with). However, there are different kinds of averages. One alternative average is a geometric mean and is actually better suited for non-linear functions. Estimate average case Theta again but this time using a geometric mean. If you are unfamiliar with this formula you can get it here (click). 5. [2 marks] In this example, averaging Theta using best/worst isn't the preferred choice because you can analyze this code and get an exact answer for theta. What is the real average time complexity (Theta) for this code? Justify your
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
