- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 690 Articles for Computer Science
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
4K+ Views
A context-sensitive grammar whose productions are of the formαAβ → αγβWhere α, β ∈ (N ∪ T)*, A ∈ N; γ ∈ (N ∪ T)+ and a rule of the form S → λ is allowed if the start symbol S do not appear on the right hand side of any rule.The language generated by such a grammar is called a context-sensitive language.Every context-free grammar is also context-sensitive =⇒ the context-free languages are a subset of the context-sensitive languages (see Chomsky Normal Form).But, not every context-sensitive language is context-free.ExampleThe language {anbncn, n > 1} is context-sensitive but not context free.A ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
706 Views
A regular grammar is the one where each production takes one of the following restricted forms −B → ∧, B → w, B → A, B → wA.(Where A, B are non-terminals and w is a non-empty string of terminals.)Restrictions of regular grammarOnly one nonterminal can appear on the right-hand side of a production.Nonterminal must appear on the right end of the right-hand side.Therefore, the productions are as follows −A → aBc and S → TUThese are not part of a regular grammar, but the production A → abcA is.Things like A → aB|cC are allowed because they are actually ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
12K+ Views
Construct deterministic finite automata that accepts at most 3 a’s over an alphabet ∑={a,b}.At most 3 a’s means,The string contains 0 to max 3 a’s and any number of b’s.L= {Є,a,aa,aaa,ab,abb,bab,bbabaa, bbabaabbb,…..}Construct DFALet’s construct DFA step by step −Step 1Valid inputs − aaa, a, aa,ε .Step 2Valid inputs − b, ba, baa, baaa, bb, bba, bbba,…Step 3Valid input − bab, abba, abbbaa, babba,…Step 4Valid inputs − babab, aabb, aaba, bbbaaba, …Step 5Valid inputs − aaabbb, aaabab, baaaba, …Step 6InValid inputs − aaaa, aaabab, baaaba,
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
7K+ Views
CKY means Cocke-Kasami-Younger. It is one of the earliest recognition and parsing algorithms. The standard version of CKY can only recognize languages defined by context-free grammars in Chomsky Normal Form (CNF).It is also possible to extend the CKY algorithm to handle some grammars which are not in CNF (Hard to understand).Based on a “dynamic programming” approach −Build solutions compositionally from sub-solutionsIt uses the grammar directly.AlgorithmBegin for ( i = 1 to n do ) Vi1 { A | A → a is a production where i th symbol of x is a } for ( j = ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
7K+ Views
A regular expression is basically a shorthand way of showing how a regular language is built from the base set of regular languages.The symbols are identical which are used to construct the languages, and any given expression that has a language closely associated with it.For each regular expression E, there is a regular language L(E).There are some general equalities for the regular expressions.PropertiesAll the properties held for any regular expressions R, E, F and can be verified by using properties of languages and sets.Additive (+) propertiesThe additive properties of regular expressions are as follows −R + E = E + ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
2K+ Views
ProblemConstruct DFA which accepts a string that contains second symbol is zero and fourth symbol is 1 over an alphabet ∑={0,1}.SolutionInput − 00110Output is accepted; because in the given string the second symbol is ‘0’ and the fourth symbol is ‘1’.Input − 11001Output − string is not accepted, because the second symbol is not ‘0’.Design DFA step by step as given below −Step 1 -Valid inputs − 0001Step 2 -Valid input − 1001Step 3 -Valid inputs − 0011, 1011Step 4 -Valid inputs − 00010, 10010, 00110, 00011, 10011, 00111, …Step 5 -Invalid inputs − 0101, 0100, 0010, 1100, 0000, 1000, …Step 6 -Valid inputs − 01010, 01000, 11111, 0100000, …
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
3K+ Views
According to the theorem, If L and M are two regular languages, then L ∩ M is also regular language.ExampleConstruct A∩B where A and B is given as follows −The language A ={10, 100, 00, 001, 1010, …..}The language B ={01, 1010, 10, 101, …..}AA = (QA, Σ, δA, qa, FA) AB = (QB, Σ, δB, qB, FB) A∩B=(QA x QB ,Σ, δ(qA x qB ,FA x F B )Where, δ(( p, q), a) =δL (p, a), δM (q, a))Here, QA x QB = {p, q} x {r, s} ={(p, r), (p, s), (q, r), (q, s)} Z = ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
2K+ Views
ProblemConstruct a deterministic finite automata (DFA) that accepts a language L which has the number of zero’s is of multiple of 3 over an alphabet ∑=”{0,1}.SolutionIf input is: 000 Output is: string is acceptedBecause here the number of zero’s is multiple of 3.Designing DFAIn order to construct the DFA, follow the below mentioned steps −Step 1 -Valid inputs: 000, 000000, 09 , 012 , …Step 2 -Valid inputs: 1, 1000, 100000, …Step 3 -Valid inputs: 10100, 11000, 101100, …Step 4 -101010, 1101010, 1101110110, …Invalid inputs − 0,00,10000,01011, …
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
808 Views
ProblemGiven language to construct the deterministic finite automata (DFA) is, the strings start with ‘a’ but not contain substring ‘aab’ over alphabet ∑={a,b}.SolutionIf the input is: “baabba”The output is: string is not acceptedBecause the string does not start with ‘a’, and generating a substring ‘abb’,DFA transition diagramThe DFA transition diagram for the string beginning with ‘a’ but not having the substring as ‘aab’ is as follows −Transition tableThe transition table is as follows −STATEINPUT (a)INPUT (b)→ 01*4 (dead state)1*2*3*2*2*4 (dead state)3*1*3*4 (dead state)4 (dead state)4 (dead State)
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
2K+ Views
Vertex cover is a subset of vertices that covers all the edges in a graph. It is used to determine whether a given graph has a 3SAT to vertex cover.Clique is called a subset of vertices that are all directly connected. It determines whether a clique of size k exists in a graph.To prove − Vertex cover can be reduced to clique.ProofGiven a graph G=(V, E) and integer k.Get its complement graph G'=(V, E').Solve CLIQUE(G', |V|-k).If there is a solution, return yes. Otherwise, it returns as no.To prove this reduction, we need to show the following −If there is a ... Read More