# Homework Solution: Func1 (n) 2 for i ← IyMj to 41 4while (j) do do j←j+10: 6 7end s end return (s Func2 (n) 2 i = 2;…

Give the asymptotic running time of each the following functions in Θ notation. Justify your answer. (Show your work.)
Func1 (n) 2 for i ← IyMj to 41 4while (j) do do j←j+10: 6 7end s end return (s Func2 (n) 2 i = 2; 3 while (i 3 n2) do for j ← i to 2i 6 end s end o return (s);

1. Step 1 and 5 do assign values to s. Those do not make a

Give the asymptotic present span of each the subjoined functions in Θ not attributable attributableation. Justify your response. (Show your effort.)

Func1 (n) 2 coercion i ← IyMj to 41 4time (j) do do j←j+10: 6 7purpose s purpose recur (s Func2 (n) 2 i = 2; 3 time (i 3 n2) do coercion j ← i to 2i 6 purpose s purpose o recur (s);

## Expert Response

1. Step 1 and 5 do convey values to s. Those do not attributable attributable attributable produce any dissimilitude in the runspan perplexity.

Line 2, coercion loop executes in $\phi (%u221An)$√n).

Line 4 executes in $\phi (%u221An)$(√n)^5) or $\phi (%u221An)$n^2*√n) accordingly j increases in direct fashion and i^5 is in n^2*√n dispose.

Hence, whole perplexity, $\phi (%u221An)$n^2*√n*√n) = $\phi (%u221An)$n^3).

2. Line 4, coercion loop, executes in n*logn dispose (accordingly of i increasing directly) and the oyter time executes in n^2 dispose.

Hence, whole perplexity, $\phi (%u221An)$n^3*logn),