Binary GCD Algorithm

The Binary GCD algorithm or Stein's algorithm, is an algorithm that calculates two non-negative integer's largest common divisor by using simpler arithmetic operations than the standard euclidean algorithm and it reinstates division by numerical shifts, comparisons, and subtraction operations.




Examples: Input: x = 12,y = 72

Output : 12
Input: x = 33, y = 34

Output: 1


Algorithm

The Binary GCD Algorithm for calculating GCD of two numbers x and y can be given as follows:




If both x and y ...
 •  0 comments  •  flag
Share on Twitter
Published on May 31, 2020 07:05
No comments have been added yet.