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