a. Language B is in complexity class TIME(1) because this language B can be recognized by deterministic Turing machine in time O(1). Below is the deterministic Turing Machine to recognize B.
(qo, € ) --> (qaccept, €, R)//accept the empty string
(qo, 1) -> (q1 , 1, R) //move right if input 1
(q1, €) --> (qaccept ,€, R) //accept if input is 1
(q1 , 1) --> (q2, 1, R)
(q2, €) --> (qaccept, €, R) //accept if input is 11
(q2, 0) -> (q3, 0, R)
(q3, 0) --> (q4, 0, R)
(q4, €) --> (qaccept, 1, R) //accept if input is 1100
We can see that input will be accepted only if it is in set B and there are constants steps to decide B, hence B is in complexity class TIME(1).
b. Since B is in complexity class TIME(1) which is subset of class P, hence B is also in class P.
Please comment for any clarification.
Theory of Computation 2. (a) Show that the language B e,1, 11,1100 is in complexity class TIME ) b) Show that the language B e, 1,11,1100 is in complexity class P. Theory of Computation 2. (a) S...
Theory of Computation. Please show all work.
Given the following FAs for the language {a} and {b}: construct the FA that is product for the language {a} +{b}. Show the transition table and draw the transition diagram convert your FA from problem 1(an FA is also a TG) into a regular expression (show the steps that you take).
Theory of computation.
Please show all work.
Construct a TG for the language of all strings where characters in odd numbered positions (i.e., the 1^st, 3^rd, 5^th, etc. characters) must be the letter "a". convert your TG from problem 3 into a regular expression (show the steps that you take).
this is from my theory of computation class i need this question is detail ans, Find a simple and nontrivial characterization of the language {111} ∗{11111} ∗ . Give a proof of the correctness of your answer.
(complexity): prove: if A is a Regular language then A∈DSPACE(O(1)) explanation:prove that the complexity class of a regular languages is DSPACE(O(1))
Match each problem to the time complexity class it likely belongs to: 1. O(1): Constant 2. O(n): Linear 3. O(n!): Factorial 4. O(logn): Logarithmic 5.O(n2): Quadratic 6. O(n3): Cubic OPTIONS: a. Find an element in an unsorted array b. Shortest path between two nodes in a graph c. Matrix multiplication d. Generate permutations of a string e. Add an element to the front of a linked list f. Find an element in a binary search tree
Define each of the following for a language L. a) L is in the class P. b) L is in the class NP. c) L is reducible to another language L' in polynomial time d) L is NP-complete
Theory of Computation - Push Down Automata (PDA) and Context
Free Grammars (CFG)
Problem 1. From a language description to a PDA Show state diagrams of PDAs for the following languages: a. The set of strings over the alphabet fa, b) with twice as many a's as b's. Hint: in class, we showed a PDA when the number of as is the same as the number of bs, based on the idea of a counter. + Can we use a...
In Java Language Write a recurrence equation expressing the time complexity of the following algorithm. Explain your answer. Assume that n is a power of 2. Algorithm rec(n) Input: Integer value n ≥ 0 if n = 0 then return 1 else { c ← 0 For i ← 0 to n−1 do c ← c + i c ← c + rec(n/2) return c }
Calculate the Big-O time complexity. Show work 4. 1^2 + 2^2 + 3^2 + · · · + (n − 1)^2 + n^2 5. 12 log(n) + n/2 − 400 6. (n^4+2n^2+2n)/n)
Theory of Computation
7. Write down the Chomsky Normal Form for the context-free language de- fined by the productions: S bAļaB. A bAA laSla, and B aBB bS b, where S, A, B are nonterminal symbols and a, b are terminal symbol 8. For the context-free grammar Ģ -(X, T, R, S) with X (A, B. C, a, b), T a, b and productions R: SAB |BC, ABAa, BCClb,C AB la, check by applying the CYK Theorem whether the string...