This lesson we talk about Anything That’s Not Measured Cannot Be Imporved. Big O. I hope this lesson is useful for you.
First Who is Big O?
In computer Science, Big O notation describes how the run time or space requirements of a program increases as the lenght of input increases.
Note: This is just the definition. Explanation coming up. Read this again after finishing the whole thing.
Big O alone can be used to describe how good an algorithm [or program] is upto a level
Big-O Complexity Chart, you can get form this site bigocheatsheet.com
|O(1)||O(log n)||O(n)||O(n log n)||O(n^2)||O(2^n)||O(n^n)|
Big O can be used to explan how long a program will take to execute and how much memory it will consume regardless of the hardware used
This is the very reason that makes Big O special
Not considering the hardware and insterd considering the algorithm [steps taken to do a task]
These are just cool terms used to signify Big O for time a big O for space
An algorithm [program here] is supposed to take linear time if its time complexity is O[N]
- An algorithm is supposed to take constant time if its time comlexity is O
How go back and take a closer look at the animation we saw earlier
Question: What will be the time comlexity of an algorithm which takes a quadratic time.