Created
July 28, 2018 17:23
-
-
Save RyanOkamuro/e612ca2512a7a6ebdd2f5af296002579 to your computer and use it in GitHub Desktop.
Big O Drills
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Even or Odd: Constant time O(1) //doesn't matter what the input size is it doesn't effect the algorithm's run time | |
Are you here?: Polynomial time O(n^k) //has nested loops | |
Doubler: Linear time O(n) //Given input a and input b, where b is twice as large as a, it will take a linear algorithm twice as long to process b compared to a. | |
Naive Search: Constant time O(1) //doesn't matter what the input size is it doesn't effect the algorithm's run time | |
Creating pairs: Polynomial time O(n^k) //has nested loops | |
Computing fibonaccis: Constant time O(1) //doesn't matter what the input size is it doesn't effect the algorithm's run time | |
correct-----Linear time O(n) //Given input a and input b, where b is twice as large as a, it will take a linear algorithm twice as long to process b compared to a | |
An Efficient Search: Logarithmic time O(log(n)) //cut the problem size in half each round through | |
Random element: Constant time O(1) //doesn't matter what the input size is it doesn't effect the algorithm's run time | |
Is it prime?: Linear time O(n) //Given input a and input b, where b is twice as large as a, it will take a linear algorithm twice as long to process b compared to a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment