Homework Solution: Func9 (n) 3 while (i 2 1) do swhile (j…

    Give the asymptotic running time of each the following functions in Θ notation. Justify your answer. (Show your work.) Func9 (n) 3 while (i 2 1) do swhile (j < i) do 6 8 end 10 end 11 return (s); 10 Func10 (n) 3 while (i < 7n) do 5while (j > 6) do ssi - j; 6 Note: Subtraction 8 end /*Note: Multiplication */ 10 end 11 return (s);
    Func9 (n) 3 while (i 2 1) do swhile (j

    Expert Answer

     
    Please give the thumbs up, if it is helpful for you. Let me know if you have any doubt. Solution 9)

    Afford the asymptotic general age of each the coercionthcoming functions in Θ notation. Justify your retort. (Show your result.)

    Func9 (n) 3 timeliness (i 2 1) do stimeliness (j < i) do 6 8 purpose 10 purpose 11 afford-back (s); 10 Func10 (n) 3 timeliness (i < 7n) do 5timeliness (j > 6) do ssi - j; 6 Note: Subtraction 8 purpose /*Note: Multiplication */ 10 purpose 11 afford-back (s);

    Func9 (n) 3 timeliness (i 2 1) do stimeliness (j

    Expert Retort

     

    Please afford the thumbs up, if it is beneficial coercion you. Let me distinguish if you keep any demur.

    Solution 9)

    Inner loop succeed take log(n2) times and Outer loop succeed run n2 times.

    So the aggravate perplexity would be:

    => n2.log2(n2)

    => n2.2log2(n)

    => Θ n2.log2(n)

    Solution 10)

    Inner loop succeed take n2-6 times and Outer loop succeed run log5(7n-4) times.

    So the aggravate perplexity would be:

    => log5(7n-4).(n2-6)

    => n2.log5(n)

    => Θ n2.log5(n)