Download
euclid algorithm gcd n.
Skip this Video
Loading SlideShow in 5 Seconds..
Euclid Algorithm: GCD PowerPoint Presentation
Download Presentation
Euclid Algorithm: GCD

Euclid Algorithm: GCD

138 Vues Download Presentation
Télécharger la présentation

Euclid Algorithm: GCD

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Euclid Algorithm: GCD GCD: Input integers a,b; Step 1: If a  b then X  a, Y  b; else X  b, Y  a; Step 2: Z  the remainder of X  Y; Step 3: If Z = 0 then the GCD is Y; else X  Y, Y  Z, do steps 2, 3 again. Problem Solved

  2. On integers. On what? Addition In general, we have 3 numbers involved. So, we need three places to hold the numbers. dec a 2 dec b 2 dec c 2 int a,b,c; a=1,b=3 move a R1 move b R2 addR1R2 moveR2 c 1111 0011 0010 0001 1111 0011 1101 0010 1010 010000010010 1111 00110010 1100 c=a+b; now, c=4

  3. ProblemsSolutions cycle ?? System analyst, Project leader Problems Programmers Algorithms Programs in C++ (High level Programming Language) compiler Assembly Assembler Machine code computer Results

  4. OOP (Object-oriented Programming) A new programming paradigm after ’80s. Problem solving  Procedure finding But Why should I have to write the same procedure to do the same job over and over again? Fact: Different problems usually consist of many common smaller problems.