Posted in the Computer Science Forum
#1 Jan 19, 2013
For the following example, I have calculated the Big-Oh value to be
O(2n^2 + 5n + 3 ). Is that correct? Since the while loop is nested within the for loop, the order of magnitude should be O(n^2).
for (int i = 0; i < n; i++)
sum += i;
int j = 0;
while (j < n)
#2 Jan 19, 2013
should be + 4, not 3.
Add your comments below
|Why Instagram Won 2016 and Snapchat Didn't||Jan 4||Mos-A||1|
|Recounts or no, US elections are still vulnerab...||Dec 31||RustyS||29|
|Jill Stein seeks recount in Wisconsin, Michigan...||Dec '16||Twang||3|
|Google also gets fooled by fake election news||Nov '16||gwww||11|
|Stoke-on-Trent teenager goes from home educatio...||Nov '16||Party Hard In Lin...||1|
|Brands Embracing Private Sharing||Nov '16||diligent||1|
|Sassy Trump is Very Disappointed With Alec Baldwin||Nov '16||un inpressed||3|
Find what you want!
Search Computer Science Forum Now
Copyright © 2017 Topix LLC