Monday, March 30, 2009
Chapter 14
- Algorithm
- Selection sort
- Big O notation
- Insertion sort
- Merge sort
Look over the code but focus on concepts not coding.
Wednesday, March 25, 2009
Can anyone make sense of the recursive algorithm?
I was working on this problem:
A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:
012 021 102 120 201 210
What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?
and I found this page:
http://www.cut-the-knot.org/do_you_know/AllPerm.shtml"Recursive algorithm
The recursive algorithm is short and mysterious. It's executed with a call visit(0). Global variable level is initialized to -1 whereas every entry of the array Value is initialized to 0.
void visit(int k)
{
level = level+1; Value[k] = level; // = is assignment
if (level == N) // == is comparison
AddItem(); // to the list box
else
for (int i = 0; i < N; i++)
if (Value[i] == 0)
visit(i);
}
"
Can anyone make sense of this?
DF
Monday, March 23, 2009
Make this simpler?
package recursion;
/** * * @author dfreer */
public class Main {
public static void countDown(int x) {
//make a recursive method that counts down from itself until 0 and
//also prints out each number...go down by one!!
if(x == 0)
{
}
else
{
System.out.println(x);
countDown(x-1);
}
}
public static int calcMinimum(int [] a, int counter, int minimum)
{
if(counter == a.length-1)
{
if(a[a.length-1] < minimum)
{
return a[a.length-1];
}
else
return minimum;
}
else
{
if(a[counter] < minimum)
{
minimum = a[counter];
System.out.println("We got here!");
return calcMinimum(a, ++counter, minimum);
}
return calcMinimum(a, ++counter, minimum);
}
}
public static void main(String[] args) { // TODO code application logic here
int [] b = {7,16,23,-55}; //expecting -55
System.out.println(calcMinimum(b,0,b[0]));
//countDown(10);
//start counter at 0 and minimum at 0 }}
Wednesday, March 18, 2009
CarCustomers Minor Project
You can use a 3 Strings and a boolean.
Add the information to an ArrayList.
Have a button that will show the information that user has entered.
Four people finished it in class. Everyone else should upload it to their FTP space before March 25, 2009.
I will be in the computer lab (6103) at 2:30 on Friday to help people with this!
Hope to see you there.
Monday, March 16, 2009
Love Tester Minor Project *In class*
Determine if they are a good match and output it to the GUI!
It doesn't have to be serious.
Minor project grade. Work with someone from class if you wish.
Due By March 23rd, 2009 on FTP.
Please write a response on your blog...
Friday, March 6, 2009
Wednesday, March 4, 2009
MySQL and Netbeans
CREATE TABLE address_books (first_name VARCHAR(25), last_name VARCHAR(25), phone_number VARCHAR(15), PRIMARY KEY (phone_number));
INSERT INTO address_books (first_name,last_name,phone_number) VALUES ('David','Freer','786-877-4573')";
-------Next, create a database for students using MySQL and a table with some information.
Then create a java program (using Netbeans) and show you are able to update it and delete data from the database.
Work with another classmate and upload it to your FTP space. However, when you finish call me over and I'll grade it in class.If you need numbers, you can use INT this.
Monday, March 2, 2009
Almost done grading the third major assignments...
Your next project is due March 15, 2008.
It comes from Chapter 12 in the book.