I've heard of bigO notation but I don't really understand how do I determine it for my code and what exactly does it represent? I heard that there are two:

  1. RunTime
  2. Memory Complexity

How can I learn to use it?

  • $\begingroup$ Welcome to Computer Science! We get asked this kind of question a lot, so we've written some reference material on the subject. See cs.meta.stackexchange.com/q/599 and the duplicates. If you have any specific questions after studying the basic material, feel free to post another question asking about it. $\endgroup$ – D.W. Jun 30 '17 at 21:46

Big O notation is nothing other than dividing functions into classes based on their asymptomatic growth behavior. What those functions are a measure of is entirely independent of Big O.

Big O is most commonly used to classify the function that maps an input size to the longest time an algorithm runs on any input of that size. But it could be used instead for average running time or shortest running time, or to measure space usage, cache misses, messages sent over the network, etc.

We use big O because we don't generally care about the exact value of these functions, just about how fast they grow. It's an abstraction that lets us see the general pattern but omits constant and lower order factors.

| cite | improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.