Documents

DESIGN AND ANALYSIS OF ALGORITHM_1.pptx

Description
Design and Analysis of Algorithm Algorithm ã a sequence of unambiguous instructions for solving a problem. i.e., for obtaining a required output for any legitimate input in a finite amount of time. EXAMPLE – Euclidean Algorithm Euclid’s algorithm for computing gcd(m, n) ã Step 1 If n = 0, return the value of m as the answer and stop; otherwise, ã proceed to Step 2. ã Step 2 Divide m by n and assign the value of the remainder to r. ã Step 3 Assign the value of n to m and the value o
Categories
Published
of 12
7
Categories
Published
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Similar Documents
Share
Transcript
  Design and Analysis of Algorithm  Algorithm ã a sequence of unambiguous instructions for solving a problem. i.e., for obtaining a required output for any legitimate input in a finite amount of time.  EXAMPLE – Euclidean Algorithm Euclid’s algorithm for computing gcd (m, n) ã Step 1 If n = 0, return the value of m as the answer and stop; otherwise, ã proceed to Step 2. ã Step 2 Divide m by n and assign the value of the remainder to r  . ã Step 3 Assign the value of n to m and the value of r to n . Go to Step 1.  Euclidean Algorithm-2 ALGORITHM Euclid(m, n) //Computes gcd (m, n) by Euclid’s algorithm //Input: Two nonnegative, not-both-zero integers m and n //Output: Greatest common divisor of m and n while n = 0 do r ← m mod nm ← nn ← r  return m
Search
Tags
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x