Question: Finding the runtime question. Question 1 Determine Running Time: 8 marks following fragments determine the worst-case O notation running time and briefly justify your answer.
Finding the runtime question.


Question 1 Determine Running Time: 8 marks following fragments determine the worst-case O notation running time and briefly justify your answer. In each case your answer should be a For each of the code function of n. If the question refers to an array you can assume that the size of that array is n. Note that you are not expected to derive a detailed cost function, just the Big O notation running time. Example n: i++) sum. Sum +i; Answer: The loop body runs in O(1) and the loop is executed o(n) times. Total running time is O(1)xo(n) o(n). for nt 0: i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
