1.

What is the computational complexity of Binary GCD algorithm where a and b are integers?(a) O (log a + log b)^2)(b) O (log (a + b))(c) O (log ab)(d) O (log a-b)This question was addressed to me by my school principal while I was bunking the class.The query is from GCD LCM Recursion, in chapter Recursion of Data Structures & Algorithms II

Answer»

Right CHOICE is (a) O (LOG a + log b)^2)

For EXPLANATION: From the Binary GCD algorithm, it is found that the computational complexity is O (log a + log b)^2) as the total number of steps in the execution is at most the total sum of number of BITS of a and b.



Discussion

No Comment Found

Related InterviewSolutions