星期一, 6月 12, 2006

Lab Hanoi Tower

The pseudocode for Hanoi Tower is as follows:
Solve(N, Src, Aux, Dst)
if N is 0 return
Solve(N-1, Src, Dst, Aux)
Move N from Src to Dst
Solve(N-1, Aux, Src, Dst)

Write the Java program based on the pseudocode in the above.

Lab Recursive Method

Write a recursive method that computes the sum of squares from 1 to n, given an interger n.