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);
    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);

    Expert Answer

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

    Give the asymptotic general occasion of each the coercionthcoming functions in Θ not attributable attributableation. Justify your apology. (Show your labor.)

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

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

    Expert Apology

     

    1. Step 1 and 5 do intrust values to s. Those do not attributable attributable attributable controlm any unlikeness in the runoccasion entanglement.

    Line 2, coercion loop executes in phi (√n)√n).

    Line 4 executes in phi (√n)(√n)^5) or phi (√n)n^2*√n) consequently j increases in straight practice and i^5 is in n^2*√n classify.

    Hence, sum entanglement, phi (√n)n^2*√n*√n) = phi (√n)n^3).

    2. Line 4, coercion loop, executes in n*logn classify (consequently of i increasing straightly) and the oyter occasion executes in n^2 classify.

    Hence, sum entanglement, phi (√n)n^3*logn),