[Current] [News] [Glance] [Search] [Instructions] [Links] [Handouts] [Project] [Outlines] [Labs] [Homeworks] [Quizzes] [Exams] [Examples] [EIJ] [API]
Back to Discussion of Exam 1; Javadoc. On to Project Discussion.
Held Tuesday, September 26, 2000
Summary
Today we continue our discussion of exam 1 by visiting the latter parts of the exam.
Notes
Overview
public static void gcd(int x, int y) {
// The GCD of anything and 0 is that thing
if (x == 0)
return y;
// The GCD of anything and 0 is that thing
else if (y == 0)
return x;
// If y evenly divides x then y is the GCD of x and y
else if ((x % y) == 0)
return y;
else
return gcd(y, x%y);
} // gcd(int,int)
public static void gcd(int x, int y) {
if (x == 0)
return y;
if (y == 0)
return x;
int smaller = y;
int larger = x;
int tmp;
while ((tmp = larger % smaller) != 0) {
larger = smaller;
smaller = tmp;
} // gcd(int,int)
Wednesday, 23 August 2000
Thursday, 24 August 2000
Tuesday, 26 September 2000
Back to Discussion of Exam 1; Javadoc. On to Project Discussion.
[Current] [News] [Glance] [Search] [Instructions] [Links] [Handouts] [Project] [Outlines] [Labs] [Homeworks] [Quizzes] [Exams] [Examples] [EIJ] [API]
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
This page may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS152/2000F/Outlines/outline.19.html
Source text last modified Wed Oct 25 10:05:37 2000.
This page generated on Fri Oct 27 08:19:55 2000 by Siteweaver. Validate this page's HTML.
Contact our webmaster at rebelsky@grinnell.edu