Homework 6

Homework 6 is due on Wednesday, August 4th.

0. Read Chapter 12. Indicating in at most three sentences one or more of the following: the passage in the reading— including its page number—you:

  • Found most difficult
  • Found most surprising
  • Would like to have discussed in the next lecture
1. Construct deterministic finite-state automata  that recognizes each of these languages.
a. The set of bit strings that have at most two 0s
b. The set of bit strings that have exactly two 0s.
2. Prove Pumping Lemma (problem 22, page 827).
3. Construct finite-state automata that recognizes the regular sets:
a. 10*1*
b. 0*(10 \cup 11)*
4. Construct a Turing machine that computes the function f(n) = 2n for all nonnegative integers n.
5. There are ten red and ten blue balls in a box. Randomly get out 5 balls. What is the probability to get 5 red balls?
6. What is the probability  of these events when we randomly select a permutation of {1, 2, .., n} where n \geq 4.
a. 1 precedes 2.
b. 1 immediately precedes 2.
c. n precedes 1 and n-1 precedes 2

Homework 5 is due on Wednesday,  July 14th.

0. Read Chapter 10. Indicating in at most three sentences one or more of the following: the passage in the reading— including its page number—you:

  • Found most difficult
  • Found most surprising
  • Would like to have discussed in the next lecture

1. Design an algorithm that reconstruct a tree from its preorder and inorder traversals.

2. Let T be a tree with n vertices. How many connected component are there when:

a,  p edges are removed (p<n-1).

b,  p vertices are removed (p<n).

If the number of connected components can not be counted, explain why.

3. Count the number of leaves of a complete binary tree of height h.

4. Discuss the A* algorithm and compare that to Depth first search and Breadth first search.

5. The Eucledian Minimum Spanning tree is is a minimum spanning tree of a set of n points in ℝd, where the weight of the edge between each pair of points is the distance between those two points. Give an algorithm for computing the Euclidean Minimum Spanning tree.