r/learnprogramming • • Apr 05 '22

Name one programming/comp sci concept you never understood and if you understand it, try to explain it to them

Name a programming concept such as virtual functions, pointers, certain algorithms, etc that you always had a hard time understanding and why.

Someone else who reads yours and does understand it, try to explain it to them to help them learn

1.6k Upvotes

738 comments sorted by

View all comments

Show parent comments

5

u/MaxwellCE Apr 06 '22

What if the algorithm is N² + N³? Could we say that has a big O of N³, or is the N² component non-negligible?

10

u/Rote515 Apr 06 '22

BigO only ever cares about the fastest growing term, so n2 + n3 would be N3 significance doesn’t matter, consider n = 20 in the above algorithm, n2 = 400 n3 = 8000 at that point n is negligible already, now imagine n=100 or n=1000 a larger power always makes the smaller power insignificant at any non trivial n