”
CS 181留学生作业 写作、 辅导algorithms作业、R程序语言作业调试、 写作R课程设计作业
CS 181 FINAL EXAM
WINTER 2020
You have 3 hours to complete this exam. You may state without proof any fact
taught in class or assigned as homework. Your algorithms must terminate on all
inputs.
1 Construct one-tape, deterministic Turing machines that decide the languages below. You
must provide both a state-transition diagram and a detailed verbal description:
a. binary strings of the form (0n1)k
(3 pts) , where n 0 and k 0;
(3 pts) b. binary strings (including ) that represent properly nested parentheses, where 0
denotes an open parenthesis and 1 denotes a close parenthesis.
(3 pts) 2 Give an algorithm that takes as input a DFA D and determines whether D accepts at
least two palindromes.
(3 pts) 3 A language L is called downward-closed if for every string w that L contains, L also
contains every prefix of w. Give an algorithm that takes as input a regular expression R
and decides whether the language that R generates is downward-closed.
(3 pts) 4 A variable T in a context-free grammar G is called essential if every derivation of every
string by G uses the variable T. Give an algorithm that takes as input a context-free
grammar G and a variable T, and decides whether T is essential in G.
(3 pts) 5 A string w is said to cover a given PDA P if there is a computation by P on w such
that every state of P is visited. Give an algorithm that takes as input a PDA P and
decides whether there is a string that covers P.
(2 pts) 6 Prove that every infinite decidable language can be partitioned into two disjoint infinite
decidable languages.
7 For each problem below, determine whether it is decidable and prove your answer:
(2.5 pts) a. on input a Turing machine M and a symbol , decide whether M ever writes on
the tape in any computation;
(2.5 pts) b. on input a Turing machine M, decide if M recognizes a decidable language.
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。