DF
CS 454, Section 001 | Sonoma State University | Spring, 2024 |
Theory of Computation
|
||
Instructor: Henry M. Walker
Lecturer, Sonoma State University |
Although much of this course has been well developed in recent semesters, the SSU CS faculty recently have approved an updated course description. Also, the required SSU Signature Project for SSU's Upper Division GE Area B Requirement for CS Majors has been rethought for this course. Currently, the Web site is reasonably stable, but modest refinements are likely. Check these pages regularly for adjustments.
Since May, 2024, the California Faculty Association (CFA) – the labor union of professors, lecturers, librarians, counselors, and coaches across the 23 California State University campuses – has been in negotiations with the management of the California State University System. After a one-day strike on Monday, January 22, the two sides have reached a tentative agreement, and the strike has been called off. Effective Tuesday, January 23, SSU classes (including CS 454) will be held as scheduled.
Definition: The height of a non-empty tree is defined as the number of nodes on the longest path from a leaf of a tree to its root; the height of an empty tree is defined to be 0.
Nodes in a Binary Tree: Suppose a binary tree T has height h. Prove that T contains at least h nodes and at most 2h - 1 nodes.
For each of the following, construct a state diagram for the specified language over the alphabet Σ = {0, 1}.
Non-negative binary integers divisible by 4 (decimal) [100 (binary)]: Consider the binary representation of non-negative integers that are divisible by 4. These numbers have the following properties:
Since the problem involves binary numbers, the relevant alphabet is Σ = {0, 1},
For each automaton, be sure all transitions are clearly identified and all states are clearly specified as accepting or not.
Comments in C/C++: C/C++ allows two types of comments:
For the purposes of this problem, suppose all characters within a C/C++ program are from the set {/, *, a, b, N, E}, where N represents the end-of-line character and E represents the end-of-file character. (In a real C/C++ program, of course, the characters a, b would be extended to all letters, digits, punctuation, etc., but that seems too extensive for this exercise.)
Notes:
// */; |   // comment, not syntax error |
f = g/**//h; | // equivalent to f = g / h; |
/*//*/ l(); | // equivalent to l(); |
m = n//**/o + p; | // equivalent to m = n + p; |
Exercise:
Consider the challenge of checking the comment
structure of a program, ignoring non-comment code and
considering statements involving only this limited alphabet.
Write an NFA with no more than 12 states that accepts exactly
"programs" in which all comments are correctly specified in
C/C++ and rejects any "program" that does not have the
proper comment structure..
created Fall, 2023 revised Fall, 2023 |
|
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu. |