CMPSCI 250: Introduction to Computation

Solutions to Second Midterm Exam Fall 2017

David Mix Barrington

Exam given 5 November 2017

Solutions posted 26 November 2017

Directions:

Question text is in black, solutions in blue.

  Q1: 20+10 points
  Q2: 30 points
  Q3: 30 points
  Q4: 30 points
Total: 100+10 points

Here are definitions of some terms, sets, predicates, and statements used on this exam.

Remember that a natural is a non-negative integer, so that the set N or all naturals is {0, 1, 2, 3,...}.

The Fibonacci numbers are a sequence of naturals defined by the rules F(0) = 0, F(1) = 1, and, for all n with n ≥ 1, F(n+1) = F(n) + F(n-1).

For every natural n, we define two graphs, a directed graph Dn and an undirected graph Un. Each has vertex set {0, 1,..., n}. The directed edges of Dn are (1) (i, i+1) for every i with 0 ≤ i ≤ n-1, (2) (i+2, i) for every even i with 0 ≤ i ≤ n-2, and (3) (i, i+2) for every odd with 1 ≤ i ≤ n-2.

We also view Dn as a labeled graph where each edge of type (1) above has cost 2, and the other edges have cost 3.

The undirected graph Un has the same vertex set as Dn, and an undirected edge whenever Dn has a directed edge. We will not have occasion to use edge costs in Un.


Directed graph D_5 with edge costs.  The graph U_5 has the 
same nodes and edges but all the edges are undirected.

      ___________        _____________
    /      3      \     /      3      \
   V               \   V               \
(0) ----> (1) ----> (2) ----> (3) ----> (4) ----> (5)
      2      \  2         2   ^  \  2         2   ^  
              \______________/    \_____________ /
                     3                   3


Last modified 26 November 2017