The order of growth for the depth of recursion associated with the recursive factorial (returns N!) method
explain how to get correct answer for the following question
Given that (n!=1 if n=0, n!=n x (n-1) x (n-2) x ... x 1) The order of growth for the depth of recursion associated with the recursive factorial (returns N!) method is: A. O(N) B. O(N^2) C. O(log2N). D. O(1).
Given the following code, what are the constraints on the input argument?
int mystery(int num){
if (num == 0) return 0;
else
if (num > 100) return -1;
else
return num + mystery(num – 1);
}
The number of recursive calls that a method goes through before returning is called: A. order of growth efficiency. B. the depth of recursion.
C. combinatorial recursive count.
The following code is supposed to return the sum of the numbers between 1 and n inclusive, for positive n. An analysis of the code using the "Three Question" approach reveals that:
int sum(int n){
if (n == 1)
return 1;
else
return (n + sum(n));
}
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)