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

1) here the first loop executes n times

Give the asymptotic present period of each the aftercited functions in Θ notation. Justify your response. (Show your effect.)

Func5(n) 2control i ← n to n2 do control j ← n to i do 6 7purpose s purpose 9 recompense (s); en Func6 (n) 2control i ← 6 to n2 do time (j

Expert Response

1)

here the primary loop executes n periods
control each external loop the secret loop executes i periods
and control each intermediate loop the secret most loop executes i^(1/2) periods

Hence the sum estimate of periods the loop is performed in stipulations of n is as follows:
n*n*n^(1/2) that is n^(5/2)

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

2)

Here externalmost loop executes n^2 – 6 periods
control each external loop secret loop executes 2i^2 periods.
Hence the sum estimate of periods the loop is performed in stipulations of n is as follows:

n^2 – 6 * 2n^2.
Ignoring the invariable the entanglement conquer be n^4