Chapter 5 Questions
Short Answer
1. According to the text of what elements make up a language such as English or C++ ?
2. It is possible to write a straightforward recursive algorithm that determines whether a given string
is in the language. Such an algorithm is called a(n) ____________________________ for the
language.
11. Given this syntax diagram:
It is a diagram for what in the
C++ language?
3. Give two examples of words that are palindromes
4. To use infix expressions, what other rules does this convention necessitate?
5. Given the infix expression (( a + b) * c Convert it to a prefix expression.
6. What two things must be true for an expression to be in prefix form?
7. Evaluate this postfix instruction 3 5 + 2 *
8. Evaluate this postfix expression 67 42 – 5 /
9. Evaluate this postfix expression 3 16 6 – * 5 /
10. Evaluate this prefix expression + 6 * – 3 2 4
11. Evaluate this prefix expression: * 4 – 5 6
12. What possible wrong choices might an algorithm make when searching for a sequence of flights
between cities?