Homework Solution: Give the asymptotic running time of each the following functions in Θ notation. Justify your…

    Give the asymptotic running time of each the following functions in Θ notation. Justify your answer. (Show your work.) Func5(n) 2for i ← n to n2 do for j ← n to i do 6 7end s end 9 return (s); en Func6 (n) 2for i ← 6 to n2 do while (j < 222) do j(1.5)j 6 7end s end 9 return (s);
    Func5(n) 2for i ← n to n2 do for j ← n to i do 6 7end s end 9 return (s); en Func6 (n) 2for i ← 6 to n2 do while (j

    Expert Answer

     
    1) here the first loop executes n times

    Give the asymptotic vulgar era of each the subjoined functions in Θ notation. Justify your solution. (Show your operation.)

    Func5(n) 2restraint i ← n to n2 do restraint j ← n to i do 6 7object s object 9 retaliate (s); en Func6 (n) 2restraint i ← 6 to n2 do time (j < 222) do j(1.5)j 6 7object s object 9 retaliate (s);

    Func5(n) 2restraint i ← n to n2 do restraint j ← n to i do 6 7object s object 9 retaliate (s); en Func6 (n) 2restraint i ← 6 to n2 do time (j

    Expert Solution

     

    1)

    here the highest loop executes n eras
    restraint each outward loop the secret loop executes i eras
    and restraint each intermediate loop the secret most loop executes i^(1/2) eras

    Hence the aggregate reckon of eras the loop is performed in provisions of n is as follows:
    n*n*n^(1/2) that is n^(5/2)

    Hence the complexity is O(n^(5/2))

    2)

    Here outwardmost loop executes n^2 – 6 eras
    restraint each outward loop secret loop executes 2i^2 eras.
    Hence the aggregate reckon of eras the loop is performed in provisions of n is as follows:

    n^2 – 6 * 2n^2.
    Ignoring the fixed the complexity conciliate be n^4