MA-351 Homework 3

Due at 4:59pm in my mailbox in SAS 3151, Wednesday, November 1, 2017

All solutions must be submitted in hardcopy either to me in class or placed in my mailbox. Note my office hours on my schedule.

  1. DMM §3.3, Problem 8, page 107. Note: in order to have a unique DFS tree, assume that the order of the neighboring vertices of each vertex is alphabetical and that you start at vertex labeled a.
  2. Consider the formula for approximating the n-th Catalan number, based on Stirling 's formula for approximating n!:

    (n+1) * (π*n)1/2
    1. Using the binary operators + (plus), - (minus), * (times), / (divides), and ^ (exponentiation), all of which have exactly 2 operands, draw the expression tree corresponding to this expression. Please note that 1/2 is not a constant, and that π is pi.
    2. Convert the expression tree into a minimally parenthesized linear infix expression string, using precedence and left-to-right rules whenever possible.
    3. Write the prefix and postfix expression string equivalent to the expression tree.
  3. Please consider the context-free grammar from class (also given in Problem 1c in the Fall 2016 second exam). Please give the parse tree for the string a+b-c*d/e↑f↑g
  4. Problem 4 in the Fall 2006 second exam.