3/26 演講
1 天以前
小志在中原學習的點點滴滴!
Write a recursive method to compute Fibonacci series.
Hint:
1.
fib(n)=fib(n-1)+fib(n-2)
2.
public static long fib(int n)
Write a Java program that computes N! where N is a positive integer.
Hint:
public static long factorial(int n)
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.
Write a sort method which takes a double array as parameterand returns the sorted array. Call this method in a main program.Hint: The lab is a rewriting of Lab Sortingto make the sorting procedure a reusable method.