In the following code segment, if the algorithm doIt has an efficiency factor of 5n, calculate the run-time efficiency of the program and determine its big-O notation, (4pts) for (int i=1; i<=n; i++) doIt(…)

Respuesta :

Answer:

run-time efficiency = 5n²

big-O notation = O(n^2)

Explanation:

for (int i=1; i<=n; i++)

doIt(…)

solution :

doIt = 5n

doIT() is dependent on n itself, then calling it within a loop also dependent on n , that makes 5n²

and

T(n) ∈ O(n^2)

Ver imagen faisalhafeezfaisal78
ACCESS MORE
EDU ACCESS