Recursion1.3 - End of Lecture Jan 19, 2012 CSE 2011 Prof....

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Last Updated 12-01-24 10:12 AM CSE 2011 Prof. J. Elder - 16 - End of Lecture Jan 19, 2012
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Last Updated 12-01-24 10:12 AM CSE 2011 Prof. J. Elder - 17 - Given two integers, what is their greatest common divisor? e.g., gcd(56,24) = Example 3. The Greatest Common Divisor (GCD) Problem divides da 8 Notation: Given d , a ! ! : d | a ! " k # ! : a = kd Important Property: d | a and d | b ! d | ax + by ( ) " x , y # ! Note : All integers divide 0: d | 0 ! d " !
Background image of page 2
Last Updated 12-01-24 10:12 AM CSE 2011 Prof. J. Elder - 18 - Euclid’s Trick Claim: gcd( a , b ) = gcd( a ! kb , b ), k " ! . Important Property: d | a and d | b ! d | ax + by ( ) " x , y # ! Use this property to make the GCD problem ea Id s ea: ier! Euclid of Alexandria, "The Father of Geometry" c. 300 BC Proof: Let d = gcd( a , b ). Then d | a ! kb ( ) . Suppose d ! gcd( a " kb , b ). Then ! " d > d : " d | a # kb ( ) and " d | b . ! " d | a # Contradiction!
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Last Updated 12-01-24 10:12 AM CSE 2011 Prof. J. Elder - 19 - Euclid’s Trick gcd( , ) gc 2 d( , ) ab a bb = gcd( , C ) gcd( , onseque : ) nce a bb = gcd( , ) gc 3 d( , ) a = . ., eg Use this property to make the GCD problem ea Id s ea:
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Recursion1.3 - End of Lecture Jan 19, 2012 CSE 2011 Prof....

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online