Big-Oh polynomial

Deerfield Beach, FL

#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)

Deerfield Beach, FL

#2 Jan 19, 2013
should be + 4, not 3.

Tell me when this thread is updated:

Subscribe Now Add to my Tracker

Add your comments below

Characters left: 4000

Please note by submitting this form you acknowledge that you have read the Terms of Service and the comment you are posting is in compliance with such terms. Be polite. Inappropriate posts may be removed by the moderator. Send us your feedback.

Computer Science Discussions

Title Updated Last By Comments
News Why Instagram Won 2016 and Snapchat Didn't Jan 4 Mos-A 1
News Recounts or no, US elections are still vulnerab... Dec 31 RustyS 29
News Jill Stein seeks recount in Wisconsin, Michigan... Dec '16 Twang 3
News Google also gets fooled by fake election news Nov '16 gwww 11
News Stoke-on-Trent teenager goes from home educatio... Nov '16 Party Hard In Lin... 1
News Brands Embracing Private Sharing Nov '16 diligent 1
News Sassy Trump is Very Disappointed With Alec Baldwin Nov '16 un inpressed 3
More from around the web