2 ms·
I think you misunderstood the Euclidean algorithm. The basic iteration is of the form gcd(a, b) = gcd(b, a mod b), and there is no need to compute mod wit
by conistonwater 12y ago
I think you misunderstood the Euclidean algorithm. The basic iteration is of the form
gcd(a, b) = gcd(b, a mod b),
and there is no need to compute mod with anything other than %.
- feliperibeiro 12y agoYou're right. This is the subtraction-based implementation, the division-based is the original and better one :) https://github.com/felipernb/algorithms.js/commit/e5a04f9ad07256ef5cd86aa2fc772dc713381de3 https://github.com/felipernb/algorithms.js/commit/e5a04f9ad0...