c) Modify Euclid's algorithm as follows function Newclid(a,b) if a
Posted: Thu Jun 02, 2022 7:52 am
c) Modify Euclid's algorithm as follows function Newclid(a,b) if a<b: swap a and b if b-0: return a return Newclid(a-b,b) i. Does Newclid(a,b) still compute gcd(a, b)? Briefly justify your answer. ii. Show that Newclid(a,b) is exponentially slower than Euclid(a,b) on certain inputs. [3 marks] [3 marks]
Posted: Thu Jun 02, 2022 7:52 am
c) Modify Euclid's algorithm as follows function Newclid(a,b) if a<b: swap a and b if b-0: return a return Newclid(a-b,b) i. Does Newclid(a,b) still compute gcd(a, b)? Briefly justify your answer. ii. Show that Newclid(a,b) is exponentially slower than Euclid(a,b) on certain inputs. [3 marks] [3 marks]