Some parts are derived from (and refer to) Exercises at the ends of Chapters 2, 3 and 4 in the Dale/Joyce/Weems text. To the extent that instructions here differ from those in the text, the instructions on these web pages take precedence. Copies of the following files are available on CSIL:
|
~cs20/p2/part1/LinkedStringLog.java
(essentially
the class on pp. 120-122). Your solution must be more efficient for at least one of
the methods.
~cs20/p2/part1/
directory also contains StringLogInterface.java
from page 72, LLStringNode.java
from page 104, and
IDTLinkedStringLog2.java
(a slight modification of class ITDArrayStringLog
from pp. 94-96) to test your work. But for your convenience (and ours), the package
statements are removed from all files.
size()
still returns correct results after
inserts and after clear()
is used.
~cs20/p2/part2/EvenOddStack.java-skeleton
.
~cs20/p2/part2/EvenOddStackInterface.java
. Both pop and both peek
methods must throw java.util.EmptyStackException if they are invoked for an
empty (part of a) stack.
CAPACITY
int values, and initializes the two
index variables according to your solution's strategy.
~cs20/p2/part2/EvenOddStackTester.java
to test your class. See part b
for execution instructions.
'#'
) and blank lines
are ignored. Include comments in stacktest.txt to explain your testing plan.
push d1
[d2 d3 ...]
where the d values are the data to push. At least one d is required, and
all d must be integers.
pop s
- where s
is the stack
section from which to pop, either even
or odd
.
peek s
- where s
is the stack
section at which to peek, either even
or odd
.
clear s
- where s
is the stack
section to clear, either even
, odd
or all
.
~cs20/p2/Palindrome.java-skeleton
,
and just revise the two methods, pal1 and pal2. Notice that main already strips out any non-letters,
and converts all letters to lower case before passing the string.
~cs20/p2/part4/Power1.java
and write
Power2.java with a more efficient
power method.