Calculate the time complexity of the following program fragments.
(a) πππ (π = 1; π β€ π; π β = 2)
{
π₯ = π₯ + 1
}
(b) πππ (π = 1; π β€ π; π + +)
πππ (π = 1; π β€ π; π = π β 2)
{
β¦ .
β¦ .
}
a)
"T(n)=\\lfloor log_2(n)\\rfloor"
b)
"T(n)=n\\lfloor log_2(n)\\rfloor"
Comments
Dear greeshma,
You're welcome. We are glad to be helpful.Β
If you liked our service please press like-button beside answer field. Thank you!
Thank you so much
Leave a comment