Tuesday, November 8, 2011


class BTree:
int element
BTree left, right, parent

processList(int a[])
{
if (*a == -1) // base case
return;
cout << *a;
processList(a+1);
}

processList(Node *a)
{
if (a == NULL) // base case
return;
cout << a->element;
processList(a.next);
}

HW 4.2: Two components to build.
Read in a file.

"The quick brown fox jumped over the lazy dog. It jumped nicely."

The file will have ASCII text.

Make a frequency array to count up how many times each character occurs. Then, print out how many times each character occurs.

Make a CharFreq class. It will store a Character and its Frequency.

class CharFreq
{
char Char;
int Freq;
}
CharFreqs should be Comparable.
There is an interface in Java called Comparable.

http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Comparable.html

How is a < b, a > b, a == b? Based only on their Frequency.




No comments:

Post a Comment