This is a set of practice questions. Feel free to work on these questions, and to ask questions if you face any difficulties in coming up with answers. While collaboration with others on the graded homework is strictly prohibited, you are free to work on these practice questions together with other people.
Since they are practice questions, you do not have to, and should not, submit answers to these questions on Blackboard. These questions will not be considered in any way towards your course grade. At the same time, based on the instructor's experience, individuals spending substantial and systematic effort in answering these practice questions by themselves tend to significantly improve their overall class performance.
Write a function that takes a string as an argument and reads a sequence of words (sequences of characters separated by blank space) from standard input, printing out those words that appear as substrings somewhere in the parameter string.
Write an efficient function that takes a string as an argument and returns the length of the longest sequence of blanks in that string, examining as few characters in the string as possible. Hint: Your program should become faster as the length of the sequence of blanks increases.
Write a program to fill in a two-dimensional array of 0-1 values by setting a[i][j] to 1 if the greatest common divisor of i and j is 1, and to 0 otherwise.
A letter means push and an asterisk means pop in the sequence:
E A S * Y * Q U E * * * S T * * * I O * N * * *.Give the sequence of values returned by the pop operations.
Given two sequences, give an algorithm for determining whether or not asterisks can be added to make the first produce the second, when interpreted as a sequence of stack operations in the sense of textbook Exercise 4.6.
Convert to postfix the expression
( 5 * ( ( 9 * 8 ) + ( 7 * ( 4 + 6 ) ) ) ).
Give, in the same manner as Figure 4.2, the contents of the stack as the following expression is evaluated by Program 4.2:
5 9 * 8 7 4 6 + * 2 1 3 * + * + *.
Prove by induction that Program 4.2 correctly evaluates any postfix expression.
Write a program that converts a postfix expression to infix, using a pushdown stack.
Implement an interpreter for a programming language where each program consists of a single arithmetic expression preceded by a sequence of assignment statements with arithmetic expressions involving integers and variables named with single lower case characters. For example, given the input:
(x = 1) (y = (x + 1)) (((x + y) * 3) + (4 * x))your program should print the value 13.
Back to the list of assignments.