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:
- Memory Complexity
How can I learn to use it?
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.Sign up to join this community
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.