- 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 1 (79.56 KiB) Viewed 15 times
c) Modify Euclid's algorithm as follows function Newclid(a,b) if a
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
c) Modify Euclid's algorithm as follows function Newclid(a,b) if a
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]