Created
June 4, 2020 10:04
-
-
Save bhaveshmunot1/9c06e575713726fc63ec5477a72e4473 to your computer and use it in GitHub Desktop.
Find Time Complexity of Recursive Implementation of N!.
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
int factorial(int n) { // T(n) | |
if (n <= 1) { // 1 | |
return 1; // 1 | |
} | |
int temp = factorial(n-1); // T(n-1) | |
return n*temp; // 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment