From guna@andrew.cmu.edu Sat Dec 8 19:53:00 2001 Date: Sat, 1 Dec 2001 09:06:46 -0500 (EST) From: Ananda D Gunawardena To: +dist+~guna/public/15100H.dl@andrew.cmu.edu, 15-100 I <+dist+~guna/public/15100I.dl@andrew.cmu.edu> Cc: Ananda D Gunawardena Subject: Lab 8 Hints Please start lab8 asap. Here are some of the things you might find useful. 1. factorial - see defintion discussed in class 2. power(x, n) = 1 if n = 0 = x * power(n-1) if n > 0 3. tower of hanoi (see notes) 4. GCD(m,n) = m if n=0 = n if m = 0 = GCD(n, m%n) if m>n = GCD(m, n%m) if m< n % is the remainder operation eg: GCD(145, 120) = GCD(145%120, 120) = GCD(25, 120) = GCD(25,120%25) = GCD(25, 20) = GCD(5, 20) = GCD(5, 0) = 5 ananda