CSCI 3333
Data Structures
Summer 2008
Homework #5

Due Date: July 16th (Wednesday)

Goals

Familiarize students with stacks, queues and dequeues.

Specification

(1) Question C:5-8. You may assume that the postfix expression is stored in a token array. Each token array may either by an operator or an operand. An operand is a floating point number. You only need to handle binary operators: +, -, * and /. If the postfix expression has a syntax error, your algorithm should raise a EXPRESSION_SYNTAX_EXCEPTION.

State two advantages of postfix expressions as compared in the regular infix expressions.

(2) R-5.6, textbook.

(3) A ww-word is defined as a word such that every prefix of it is also a word. A max-ww-word is a ww-word that no proper suffix of it is a ww-word. For example, in the dictionary words2.txt, "goal" is a max-ww-word, because "g", "go", "goa" and "goal" all appears in the dictionary. On the other hand, "goa" is a ww-word, but not a max-ww-word since "goal" is a ww-word and a proper suffix of "goa".

Write a Java or C++ program to find out all max-ww-words in words2.txt. You may assume that in words2.txt:

Submission