Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IV. Finding greatest common divisor, for example the largest number that divides both 20 and 30 is 10. So gcd (20,30)=10, gcd (1,15)-1, gcd

 

IV. Finding greatest common divisor, for example the largest number that divides both 20 and 30 is 10. So gcd (20,30)=10, gcd (1,15)-1, gcd (25,25)-25. The gcd can be found using the strategy below. Since a and b can be very large numbers, assume both start as n/2-bit numbers with divide taking lg. (n/2) steps and subtraction taking n/2 steps i. Give the pseudocode for gcd. ii. Find T(n) where n is the number of bits of a + number of bits of b (both are n/2 bit numbers initially which add to n bits). iii. Using the worst case situation, solve T(n) to find closed form running time Given gcd(1,b)=gcd(a,1)=1 for any a.b>=1 2 ged(a/2, b/2) if a, b are even gcd(a, b) = gcd (a, b/2) if a is odd, b is even gcd ((a b)/2, b) if a, bare odd

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions