![]() |
Assignment 6The Assignmenthttp://www2.hawaii.edu/~tp_250/ICS211/Fall03/hw06.htm
CommentsStackNote that this program/method takes a String to balance. You may want to specify a constructor that takes a String/StringBuffer/char[] of pairs of characters to match:
Or you can write a method to set or add pairs of delimeters.
You can implement your own Stack, or use one of the book's implementations. You can also use java.util.Stack for your stack implementation. However, limit yourself to calling only those methods defined in the book's Stack ADT: push, pop, peek, isEmpty, size, popAll/removeAll. You will need to decide what to do with improperly nested delimiters. For instance, in "{[}]" all open marks have a closing mark. However, they are improperly nested and should probably be either "{}[]" or "{[]}". It is pretty standard practice to require that delimiters be properly nested to be considered balanced. (It's easier to implement this way too.) But when you make a decision like this, you need to add a short comment on it in your documentation. Deque (or dequeue or deq)The assignment says to write a reference-based implementation. I recommend you use a doubly-linked list, which uses double-ended Nodes. (That is, each node has both a setNext and a setPrev method.) Remember in deques you need to differentiate which end you are affecting. That is, dequeue and enqueue methods become dequeueFront and dequeueBack and enqueueFront and enqueueBack. You will also need a peekFront and a peekBack method. GradingThis assignment will be out of 10 points. You will get points for the following:
|
~ztomasze Index :
TA Details: ICS211:
Assignment 5 http://www2.hawaii.edu/~ztomasze |
Last Edited: 29 Oct 2003 ©2002 by Z. Tomaszewski. |