
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Consider the following recursive method.
int recursum(int a, int b)
{
if (a%b == 0)
return b;
else
return recursum (b, a%b);
}
a. What is the output given by recursum (48, 18)?
b. What is the output given by recursum (85, 25) ?
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write a recursive method that returns the value of N! (N factorial) using the definition given in this chapter. Explain why you would not normally use recursion to solve this problem.arrow_forwardsolve q7 only pleasearrow_forwardFor each of the following recursive methods, identify the base case, the general case, and the constraints on the argument values, and explain what the method does. (images below)arrow_forward
- The solution can be handwritten b) Trace the following recursive method for the function call “isPalindrome(rotator)” and show the output result.arrow_forwardwrite a code in java (using recursion)arrow_forwardJava - Write an iterative method that calculates the SUM of all integers between 1 and a given integer N (input into the method). Write a corresponding recursive solution. (return answer, don’t print)arrow_forward
- 14) What does the following recursive method determine?public boolean question16(int[ ]a, int[ ] b, int j){if(j = = a.length) return false;else if (j = = b.length) return true;else return question16(a, b, j+1);}a) Returns true if a and b are equal in size, false otherwiseb) Returns true if a is larger than b, false otherwise c) Returns true if b is larger than a, false otherwise d) Returns true if a and b have no elementse) Returns the length of array a + length of array barrow_forwardWrite a Non tail recursion and a tail recursion method in Java with a test class that does the following: The factorial of a positive integer n —which we denote as n!—is the product of n and the factorial of n 1. The factorial of 0 is 1. Write two different recursive methods in Java that each return the factorial of n. Please and Thank youarrow_forwardFor questions 1 – 2, use the following recursive method.public int question1_2(int x, int y){if (x == y) return 0;else return question1_2(x-1, y) + 1;} 2) Calling this method will result in infinite recursion if which condition below is initially true?a) (x = = y)b) (x != y)c) (x > y)d) (x < y)e) (x = = 0 && y != 0)arrow_forward
- The factorial of a positive integer n —which we denote as n!—is the product of n and the factorial of n 1. The factorial of 0 is 1. Write two different recursive methods in Java that each return the factorial of n. Analyze your algorithm in Big-Oh notation and provide the appropriate analysis, ensuring that your program has a test class.arrow_forwardWhich recursive method would return a value of 210 if result(7) was called? Question 1 options: public int result(int a){ if (a == 1){ return a; } else{ return a * result(a - 2); }} public int result(int a){ if (a == 1){ return 1; } else{ return a * result(a - 2); }} public int result(int a){ if (a == 1){ return a + 1; } else{ return a * result(a - 2); }} public int result(int a){ if (a == 1){ return 1; } else{ return a * result(a - 1); }}arrow_forwardsolve q5 only pleasearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education