Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Data Structures - Retired Exploring the Java Collection Framework Lists

Sina Maleki
Sina Maleki
6,135 Points

Big O Notation problem

Hi everyone who knows any thing about "Drop the less significant terms" subject in Big O Notation? I confused because I don't know why when our runtime is O(n + n^2) we just call O(n^2)?

1 Answer

Jon Kussmann
PLUS
Jon Kussmann
Courses Plus Student 7,254 Points

Hi Sina,

When we use big O notation, we are concerned with "large" values of n. Let's use your examples of O(n + n^2) and O(n^2). If n is small (let's say 10) then the values are 110 and 100, respectively. There is a 10% difference between them, which you could argue is pretty significant.

Now let's say n is 1,000. The values would then be 1,001,000. This is a 0.1% difference.

As n gets larger, the smaller terms make less of a difference in terms of the overall value, which is why we can drop the smaller terms - they do not make a significant difference to the overall value.

I hope this helps.