Big - O Flashcards
What is Big-O?
Big-O notation is an assessment of an algorithm’s efficiency. Big-O notation helps gauge the amount of work that is taking place.
What does the Big-O notation look like for:
1) constant
2) logarithmic
3) linear
1) O(1)
2) O(log2 N)
3) O(N)
What does the Big-O notation look like for:
1) linearithmic
2) quadratic
3) exponential
1) O(N log2 N)
2) O(N2)
3) O(Nn)
Why do we need to know the Big-O Notation?
One of the main reasons for consulting Big-O is to make decisions about which algorithm to use for a particular job.
How do you apply a Big-O notation?
In order to properly apply a BigO notation, it is important to analyze a piece of code to see what the code is doing and how many times it is doing it.
What’s the formal defintion for Big-O?
BigO is bound(N) if runTime(N) <= c * bound(N)
What are some things to consider then determining the Big-O?
It’s determined by the most restrictive Big-O possible so that the Big-O grows at a faster rate than the actual runtime of the code.