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)

    Produce the asymptotic exoteric duration of each the restraintthcoming functions in Θ notation. Justify your retort. (Show your is-sue.)

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

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

    Expert Retort

     

    Please produce the thumbs up, if it is beneficial restraint you. Let me recognize if you enjoy any dubitate.

    Solution 9)

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

    So the balance complication would be:

    => n2.log2(n2)

    => n2.2log2(n)

    => Θ n2.log2(n)

    Solution 10)

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

    So the balance complication would be:

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

    => n2.log5(n)

    => Θ n2.log5(n)