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 present spell of each the subjoined functions in Θ not attributable attributableation. Justify your apology. (Show your performance.)

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

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

    Expert Apology

     

    1. Step 1 and 5 do specify values to s. Those do not attributable attributable attributable construct any variety in the runspell perplexity.

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

    Line 4 executes in phi (√n)(√n)^5) or phi (√n)n^2*√n) owing j increases in straight fashion and i^5 is in n^2*√n adjust.

    Hence, completion perplexity, phi (√n)n^2*√n*√n) = phi (√n)n^3).

    2. Line 4, ce loop, executes in n*logn adjust (owing of i increasing straightly) and the oyter suitableness executes in n^2 adjust.

    Hence, completion perplexity, phi (√n)n^3*logn),