Help I'm dumb 4

Posted by Zearog@reddit | learnprogramming | View on Reddit | 12 comments

Might be on the wrong thread. Apologies for the wording. I have the vocabulary of a two year old.

Java class // For some reason, big O notation is not clicking for me. So far, the two main concepts that keep coming up in the is class run time and memory complexity(efficiency?). I understand those concepts, I think. Runtime: how long the code takes to run. Memory: how much resource(?) it takes to run the code. The issue I've repeatedly run into is the math(?) portion of it; rather, how do I determine what's O(1), O(logn), O(n), O(nlogn), O(n\^2), O(2\^n), or O(!n)?

What I think I know:

If the longest runtime of a piece of my code is O(n\^2), then it does not matter how many lower runtime pieces of code I add, the end result will still be O(n\^2).

Stacking the same runtime will result in the same runtime. i.e. stacking an n amount of O(n) will still result in O(n).