A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

What is the time complexity of Euclid's GCD algorithm?

Best Answers

Let's estimate this algorithm's time complexity (based on n = a+b). The number of steps can be linear, for e.g. gcd(x, 1), so the time complexity is O(n). This is the worst-case complexity, because the value x + y decreases with every step. 12.2. Euclidean algorithm by division. read more

Algo GCD(x,y) { // x >= y where x & y are integers if(y==0) return x else return (GCD(y,x%y)) } Time Complexity : 1. Best Case : O(1) if y is divisible of x, then Euclid GCD terminates in one call. 2. read more

Encyclopedia Research

Wikipedia:

Related Facts

Related Types

Image Answers

Full Binary Trees Definition: - ppt download
Source: slideplayer.com