COSC 2011 3.0 Fundamentals of Data Structures

Assignment 3

  1. Design an interface Deque for the deque abstract data type described on page 93. Don't forget the exceptions.
  2. Implement the Stack interface using the Vector class. More information about this class can be found here.
  3. A palindrome is a string that reads the same forwards as backwards. Using only a stack and a queue and the stack and queue methods (and some control flow statements), complete the following class to determine whether the command line arguments form a palindrome.
    public class Palindrome {
    
        public static void main(String[] args) {
    
            boolean palindrome;
    
    	if (palindrome) {
                System.out.println("This is a palindrome.");
            } else {
                System.out.println("This is not a palindrome.");
            }
        }
    }
    
    You may use the classes Stack.java, Queue.java, StackException.java, QueueException.java, Node.java, ListStack.java and ListQueue.java. For example,
    java palindrome l e p e l
    
    should print out
    This is a palindrome.