CS
215 - Fundamentals of Programming II
Spring 2008 - Homework 6
35
points
Out:
March 17, 2008
Due: March 26, 2008 at
the beginning of class, no late work accepted
Reminder: Wednesday, March 26, is the review day for Exam 2. We will be going over this assignment in class as part of the review. Therefore the this assignment is due at the beginning of class on that day, and no late work will be accepted.
Answer the following exercises from the textbook. When a question says “implement” just write the implementations on paper. You do not need to type the code into the computer (unless you want to, of course).
(6 points) Exercise 13 on pages 319-320.
(2 points) Exercise 20 on page 321.
(3 points) Exercise 21 on pages 321-322.
(4 points) Exercise 22 on page 322.
(2 points) Exercise 14 on page 377. Be sure it is clear in your answer where the top of the stack is.
(3 points) Exercise 15 on page 377.
(4 points) Exercise 17(b) on page 378. If n < 1 or s.size() < n, throw the RangeError exception. (Hint: you may need to use additional local stacks.)
(2 points) Exercise 10 on pages 426-427. Be sure it is clear in your answer where the front of the queue is.
(2 points) Exercise 11 on page 427.
(4 points) Exercise 20 on pages 429-430. (Hint: you may need to use additional local queues.)
(3 points) Write a code or pseudo-code fragment to show how you could use a stack and a queue to determine if a string is a palindrome.
03/16/08