Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
cs5200 Problem Set
1. Boolean operators NAND and NOR are de ned as follows
NAND true false
true false true
false true true
NOR true false
true false false
false false true
You are given a boolean expression consisting of a string of the symbols true,
false, separated by operators AND, OR, NAND and NOR but without any
parentheses. Count the number of ways one can put parentheses in the ex-
pression such that it will evaluate to true. (20 pts)
2. You are given a 2D map consisting of an CR grid of squares; in each square
there is a number representing the elevation of the terrain at that square.
Find a path going from square (1;R) which is the top left corner of the map
to square (C; 1) in the lower right corner which from every square goes only
to the square immediately below or to the square immediately to the right
so that the number of moves from lower elevation to higher elevation along
such a path is as small as possible. (20 pts)
3. In a pond there is a sequence on n lily pads arranged in a straight line:
1; 2; 3 : : : n . On lily pad i there are fi 0 ies. On lily pad 1 there is a
frog sitting. The frog can only jump forward from a lily pad i to either lily
pad i+3 or lily pad i+4. Find the largest number of ies that the frog can
catch. (20 pts)
Hint: be careful: not all lily pads are accessible to the frog; the frog can only
jump from the starting lily pad 1 to lily pads 4 and 5 but cannot access lily
pads 2 and 3. Also, for some i there might be no ies on that lily pad (i.e.,
fi = 0). So you want to distinguish between lily pads without ies but which
are accessible and lily pads which are not accessible.
4. You are on vacation for N days at a resort that has three possible activities
1,2 and 3. For each day i, for each activity 1,2 or 3, you’ve determined how
much enjoyment e(i; j) (1 i n; 1 j 3) you will get out of that
activity if you do it on that particular day (the same activity might give you
a dierent amounts of enjoyment at dierent days). However, you are not
allowed to do the same activity two days in a row. Design an algorithm for
determining the maximum total enjoyment possible over the entire stay of
N days and the sequence of activities you should do at each day. (20 pts)