HW: Postfix notation, redux. This time, instead of simply evaluating, we want to build the expression tree.
Homeworks as they are due:
Binary expression tree (part one) -- next Tuesday, Feb 28
Binary expression tree (part two) -- next Thursday, Mar 1
Your stack implements Queue, Mar 6
Array-based Queue, Mar 8
Thursday, February 23, 2012
Tuesday, February 14, 2012
Late Homework Guidelines
Each homework is graded on a scale from 0 to 5.
For each day late, 0.5 is deducted from the total possible score for that homework.
The first few (four) homeworks are due this Thursday.
For each day late, 0.5 is deducted from the total possible score for that homework.
The first few (four) homeworks are due this Thursday.
Monday, February 13, 2012
"It seems like there is a neater way to do this, without all the @supress warnings."
http://stackoverflow.com/questions/1025837/initialize-java-generic-array-of-type-generic
http://stackoverflow.com/questions/529085/java-how-to-generic-array-creation
http://stackoverflow.com/questions/1025837/initialize-java-generic-array-of-type-generic
http://stackoverflow.com/questions/529085/java-how-to-generic-array-creation
Tuesday, February 7, 2012
lecture 3
I described up to postfix using arrays assignment (#4).
int x[] = new int[100];
for (int i = 0; i< x.length; i++)
System.out.println(x[i]);
for (int p : x)
System.out.println(p);
interfaces
Iterable
Iterator
when I implement Iterable, I must provide a
method called iterator()
iterator returns Iterator
anything implementing Iterator must provide
boolean hasNext()
next()
int x[] = new int[100];
Iterator i = x.iterator();
while(i.hasNext())
{
int p = i.next();
System.out.println(p);
}
syntactic sugar
Subscribe to:
Posts (Atom)