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)

    Present the asymptotic prevalent period of each the aftercited functions in Θ notation. Justify your acceptance. (Show your performance.)

    Func9 (n) 3 opportunity (i 2 1) do sopportunity (j < i) do 6 8 object 10 object 11 yield (s); 10 Func10 (n) 3 opportunity (i < 7n) do 5opportunity (j > 6) do ssi - j; 6 Note: Subtraction 8 object /*Note: Multiplication */ 10 object 11 yield (s);

    Func9 (n) 3 opportunity (i 2 1) do sopportunity (j

    Expert Acceptance

     

    Please present the thumbs up, if it is advantageous control you. Let me perceive if you accept any vacillate.

    Solution 9)

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

    So the aggravate entanglement would be:

    => n2.log2(n2)

    => n2.2log2(n)

    => Θ n2.log2(n)

    Solution 10)

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

    So the aggravate entanglement would be:

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

    => n2.log5(n)

    => Θ n2.log5(n)