Josh Waxman
Cs 313 - Data Structures using Java
qccs313.blogspot.com
Data Structure?
Array -- dense list
Stack: what methods?
push, pop, top, empty, full
interface to the stack
what guts?
array of size 100 of int
interface is a contract
JStack
interface Stack {....}
class JStack implents Stack
{
...
}
foo(Stack<T> s)
{
s.pop();
}
Try this:
write a Java method swap that takes
in two ints (or, Integers) and swaps them.
void swap(int a, int b)
void swap(Integer a, Integer b)
one hint as to why Java stinks.
deprecate a feature
C++:
if (x = 56)
{
}
?: operator
if (x == 6)
7;
else
6;
z = (x==6 ? 7 : 6);
x==6? y = 7: p = 67;
switch case
switch(x)
{
case 1:
break;
case 2:
...
...
...
case 9:
...
...
...
break;
default:
...
...
...
}
auto fall-through disallowed
Monday, January 31, 2011
Sunday, January 30, 2011
HW #1
Step 1: Make a stack of integers based a dense list with a maximum capacity of 100.
Step 2: Let it grow.
Step 3: Templatize it.
Step 4: Make it implement the appropriate interfaces.
Step 2: Let it grow.
Step 3: Templatize it.
Step 4: Make it implement the appropriate interfaces.
Syllabus
Midterm -- 30%
Final -- 40%
Homeworks -- 30%
Approximately 10 homework projects
The book:
Data Structures and Algorithms in Java, 5th Edition
by Michael Goodrich
ISBN-13: 978-0-470-38326-1
Tentative syllabus:
We will follow the order of the book. See the PowerPoint slides for a
Final -- 40%
Homeworks -- 30%
Approximately 10 homework projects
The book:
Data Structures and Algorithms in Java, 5th Edition
by Michael Goodrich
ISBN-13: 978-0-470-38326-1
Tentative syllabus:
We will follow the order of the book. See the PowerPoint slides for a
Subscribe to:
Posts (Atom)