1.

What is the GCD of a and b?(a) a + b(b) gcd (a-b, b) if a>b(c) gcd (a+b, a-b)(d) a – bI have been asked this question in class test.The query is from GCD LCM Recursion, in division Recursion of Data Structures & Algorithms II

Answer»

Correct OPTION is (b) gcd (a-b, b) if a>b

Best explanation: As PER EUCLID’s ALGORITHM, gcd (a, b) = gcd (a-b, b) if a > b or gcd (a, b) = gcd (a, b-a) if b > a.



Discussion

No Comment Found

Related InterviewSolutions