Created
May 17, 2018 17:19
-
-
Save DikshaSach/3df0b16577b2493e4307040cf23a861b to your computer and use it in GitHub Desktop.
This file contains 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 Run time Complexity O(1) | |
Are you here?:- Nested Loop so Polynomial time Complexity O(n^2) | |
Doubler- Linear because values get doubled O(n) | |
Naive Search- Linear because if array gets doubled the algorithm will take double the amount of time to get a solution. | |
The time it takes for the algorithm to complete is dependent on the array and not item so the array can get doubled, tripled | |
quadrupled in length but the time will be a linear upward slope. O(n) | |
Creating pairs:- Polynomial time complexity O(n^2) Has two for loops. | |
Computing fibonaccis:- Linear time taken will depend solely on the number parameter. O(n) | |
An Efficient Search:- Logorthmic Time Complexity O(logn) Time complexity is dependent on array length. | |
Random element:- Const Run Time Complexity O(1) | |
Is it prime?:- Linear becaues n can get doubled tripled etc and the time it would take for the second loop to execute will be dependent on it. O(n) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment