package recursion;
/**
*
* @author dfreer
*/
public class SmallestNumber {
//How are we going to use recursion to figure out the smallest number???
//take in an array of integers
public static int findSmallest(int [] a)
{
//call another method with a counter
return findSmallestRecursively(a, 0);
//return smallest number (int)
}
public static int findSmallestRecursively(int [] a, int counter)
{
//base case
//if we've reached the end of the array, stop! return minimum!
//if statement to determine whether next number is smaller or larger
//keep track of the smallest number using a variable (int)
//call findSmallestRecursively from itself!! (this is what makes recursion)
//within the recursive call increment counter!
}
public static void main(String []args)
{
//call the first method!
}
Monday, July 28, 2008
Final Exam Review
Click here.
It will be 50% conceptual and 50% coding. The coding will be similar to the exam 4's.
8 people have A's after last test.
Here's the grades.
It will be 50% conceptual and 50% coding. The coding will be similar to the exam 4's.
8 people have A's after last test.
Here's the grades.
On your blog
Please write about the relationship between data structures and algorithms.
What is the difference between a stack and a queue?
Pick two sorting algorithms and explain how they work.
What is the difference between a stack and a queue?
Pick two sorting algorithms and explain how they work.
Final Major Project
What are you working on or planning to do for your last project? Major project 5.
Please post this on your blog.
Please post this on your blog.
Monday, July 21, 2008
Final project
July 30, 2008
For the final project, be creative and think of an application or game that interests you. It can be done with Netbeans as a GUI or as a console based program.
I'm not asking for anything in particular but it should be along the lines that we've done in class. A program that outputs "Hello World!" won't cut it.
So it could be related to business or gaming or personal interests. 30% of the grade will be for creativity, 50% if it runs, and 20% if it does what it says it does!
Email me if you need some ideas. You can work with someone else in the class as well.
For the final project, be creative and think of an application or game that interests you. It can be done with Netbeans as a GUI or as a console based program.
I'm not asking for anything in particular but it should be along the lines that we've done in class. A program that outputs "Hello World!" won't cut it.
So it could be related to business or gaming or personal interests. 30% of the grade will be for creativity, 50% if it runs, and 20% if it does what it says it does!
Email me if you need some ideas. You can work with someone else in the class as well.
Second blog for today: Using recursion....
How could you use recursion to find the smallest value in an array? Don't write out Java code, just write out the pseudocode.
Subscribe to:
Posts (Atom)
