Big O notation : Understanding different time complexities
We already discussed what is Big O and how it helps in writing more clean codes by avoiding nested loops and improving efficiency.
But we haven’t explained Big O types explicitly and how to figure out how to find complexity for a algorithm. Here we will go through each complexity and how to achieve it .
Big O:
The above image shows different time complexities for Big O. it shows how many times an operation need to be repeated before we get the result for worst case situation.
in the previous article we discussed that there are other complexities also for best case , average and then worst. Big O represents worst case only, as we are most concerned about how system handles worst case conditions.
Eg: for looking for an item in an array