算法设计与分æž

算法设计与分æž

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
习习 1.1 5..习习习习 gcd(m,n)=gcd(n,m mod n)习习习习习习习 m,n 习习习. Hint: 习习习习习习习习习习习: 习习 d 习习 u 习 v, 习习 d 习习习习习 u±v; 习习 d 习习 u,习习 d 习习习习习 u 习习习习习习 ku. 习习习习习习习习习 m,n,习 d 习习习 m 习 n,习习 d 习习习习习 n 习 r=m mod n=m-qn习习习习习 d 习习习 n 习 r习习习习习习习 m=r+qn 习 n习 习习(m,n)习(n,r)习习习习习习习习习习习习习习习习习习习习习习习习习习习习 gcd(m,n)=gcd(n,r) 6.习习习习习习习习习习习习习习习习习,习习习习习习习习习习习习?习习习习习习习习习习习习习习,习习习习习习习习习习习? Hint: 习习习习习习 0<=m<n 习习习习习,Euclid 习习习习习习习习习习习 m 习 n, 习 gcd(m,n)=gcd(n,m) 习习习习习习习习习习习习习. 7.a.习习习习 1≤m,n≤10 习习习, Euclid 习习习习习习习习习习? (1 习) b. 习习习习 1≤m,n≤10 习习习, Euclid 习习习习习习习习习习? (5 习) gcd(5,8) 习习 1.2 1.(习习习习) P—习习 W—习 G—习习 C—习习 2.(习习习习) 1,2,5,10---习习习习 4 习习, f—习习习 4. 习习习习习习习 a,b,c, 习习习习习习习习 ax^2+bx+c=0 习习习,习习习习习习习习习习(习习习习 sqrt(x)习习习习习习习习) 习习 Quadratic(a,b,c) //习习习 ax^2+bx+c=0 习习习习习习 //习习:习习习 a,b,c //习习:习习习习习习习习 If a≠0 D←b*b-4*a*c If D>0 1
Image of page 1

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

View Full Document Right Arrow Icon
temp←2*a x1←(-b+sqrt(D))/temp x2←(-b-sqrt(D))/temp return x1,x2 else if D=0 return –b/(2*a) else return “no real roots” else //a=0 if b≠0 return –c/b else //a=b=0 if c=0 return “no real numbers” else return “no real roots” 5.   习习习习习习习习习习习习习习习习习习习习习 a. 习习习习习 b. 习习习习习习 解解解  a. 解解解解解解解解解解解解解解解解解 习习习习习习习习 n 习习习习习习 n 习习习习习习习 习习习习习 n 习习 2习习习习习 Ki(i=0,1,2...)习习习习 n 习习习习习习 n=0习习习习习习习习习习习习习习 习习习习习 Ki 习习 i 习习习习习习习习习 b. 解解解 习习 DectoBin(n) //习习习习习习 n 习习习习习习习习习习习 //习习习习习习 n //习习习习习习习习习习习习习习习习习习习习习习 Bin[1...n]习 i=1 while n!=0 do { Bin[i]=n%2; n=(int)n/2; i++; } while i!=0 do{ print Bin[i]; i--; } 9.习习习习习习习习,习习习习习习习习习习习习习习习习习习习习.(习习习) 习习习习习习习习习习习习习. 习习 MinDistance(A[0..n-1]) //习习:习习 A[0..n-1] 2
Image of page 2
//习习:the smallest distance d between two of its elements 习习 1.3 1. 习习习习习习习习习习,习习习习习习习习习习习习习习习习习习,习习习习习习习习习习,习习习习习习习习,习习习习习习习习习习习习习习习习习习.
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern