Question: create the recursive function BinaryGcd (a, b) based on the following pseudo code # recursive pseudo-code def BinaryGCF (a,b): arrange order so a b
create the recursive function BinaryGcd (a, b) based on the following pseudo code # recursive pseudo-code def BinaryGCF (a,b): arrange order so a b if a==0: if a and b are even: else if a is even: else if b is even: else: done, b is GCF GCF (a,b) = 2*GCF (a/2, b/2) GCF (a,b) = GCF (a/2, b) GCF (a,b) GCF (a,b) GCF (a,b/2) GCF (a,b-a) (b) demonstrate that it gives the same results as pfGCD (a,b) and EuclidGCD (a, b) from A1.5. In [ ]: def BinaryGCF (a,b): "enter the recursive code below" for a,b in [(660, 350), (99,53), (30,84)]: # demonstrate all GCD functions give the same result
Step by Step Solution
3.49 Rating (152 Votes )
There are 3 Steps involved in it
code def BinaryGCDa b recursive pseudocode if a b ab ba if a 0 return b if ... View full answer
Get step-by-step solutions from verified subject matter experts
