![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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 345 Articles for Data Structure Algorithms
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
721 Views
Here CFL refers to Context Free Language. Now, let us understand closure under concatenation.Closure under ConcatenationsIf L1 and L2 are CFLs, then L1L2 is a CFL.Follow the steps given below −L1 CFL implies that L1 has CFG1 that generates it.Assume that the nonterminals in CFG1 are S, A, B, C, . . ..Change the nonterminal in CFG1 to S1, A1, B1, C1, . . ..Don’t change the terminals in the CFG1.L2 CFL implies that L2 has CFG2 that generates it.Assume that the nonterminals in CFG2 are S, A, B, C, . . ..Change the nonterminal in CFG2 to S2, A2, ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
558 Views
If L1 and L2 are CFLs, then their union L1 + L2 is a CFL.Here CFL refers to Context Free Language.L1 CFL implies that L1 has a CFG, let it is CFG1, that generates it.Assume that the nonterminals in CFG1 are S, A, B, C, . . ..Change the nonterminal in CFG1 to S1, A1, B1, C1, . . ..Don’t change the terminals in the CFG1.L2 CFL implies that L2 has a CFG, Let it is CFG2, that generates it.Assume that the nonterminals in CFG2 are S, A, B, C, . . ..Change the nonterminal in CFG2 to S2, A2, ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
2K+ Views
Let us begin by understanding about the subset in the theory of computation (TOC).SubsetIf A and B are sets, then A ⊂ B (A is a subset of B) if w ∈ A which implies that w ∈ B; that is every element of A is also an element of B.ExamplesLet A = {ab, ba} and B = {ab, ba, aaa}. Then A ⊂ B, but B ⊄ A.Let A = {x, xx, xxx, . . .} and B = {∧, x, xx, xxx, . . .}. Then, A ⊂ B, but B ⊄ A.Let A = {ba, ab} and ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
4K+ Views
A string over an alphabet is a finite sequence of letters from the alphabet.Examplestoc, money, c, and adedwxq are strings over the alphabet ∑ = {a, b, c, . . . , z}.84029 is a string over the alphabet ∑ = {0, 1, 2, . . . , 9}.Empty StringThe empty string or null string, denoted by ∧, is the string consisting of no letters, no matter what type of language we are considering.String concatenationGiven two strings w1 and w2, we define the concatenation of w1 and w2 to be the string as w1w2.ExamplesIf w1 = pq and w2 = ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
2K+ Views
A set is an unordered collection of objects or an unordered collection of elements. Sets are always written with curly braces {}, and the elements in the set are written within the curly braces.ExamplesThe set {a, b, c} has elements a, b, and c.The sets {a, b, c} and {b, c, b, a, a} are the same since order does not matter in a set and since redundancy also does not count.The set {a} has element a. Note that {a} and a are different things; {a} is a set with one element a.The set {xn: n = 1, 2, 3, ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
6K+ Views
A context-free grammar is a quadruple G = (N, T, P, S), Where, N is a finite set of nonterminal symbols, T is a finite set of terminal symbols, N ∩ T = ∅, P is a finite set of productions of the form A → α, Where A ∈ N, α ∈ (N ∪ T)*, S is the start symbol, S ∈ N.Construct a Context free grammar for the language, L = {anbm| m ≠n}Case 1n > m − We generate a string with an equal number of a’s and b’s and add extra a’s on the left −S ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
3K+ Views
A Turing machine (TM) can be formally described as seven tuples −(Q, X, ∑, δ, q0, B, F)Where, Q is a finite set of states.X is the tape alphabet.∑ is the input alphabet.δ is a transition function:δ𝛿:QxX->QxXx{left shift, right shift}.q0 is the initial state.B is the blank symbol.F is the final state.A Turing machine T recognises a string x (over ∑) if and only when T starts in the initial position and x is written on the tape, T halts in a final state.T is said to recognize a language A, if x is recognised by T and if and ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
360 Views
A Deterministic Finite automata (DFA) is a five tuplesM=(Q, ∑, δ, q0, F)Where, Q − Finite set called states.∑ − Finite set called alphabets.δ − Q × ∑ → Q is the transition function.q0 ∈ Q is the start or initial state.F − Final or accept state.Let’s see the worst case number of states in DFA for the language A∩B and A*Let A and B be the two states, |A| = number of states = nA|B| = number of states = nBDFA = |A∩B| =nA.nB|A ∪ B| =nA.nB|A*|=3/4 2nA|AB| = nA (2nB-2nB-1)NFAThe non-deterministic finite automata (NFA) also have five states ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
1K+ Views
Let G = (V, T, P, S) be a CFL. If every production in P is of the form as given belowA -> aaWhere A is in V, a is in T, and a is in V*, then G is said to be in Greibach Normal Form (GNF).ExampleS -> aAB | bB A -> aA | aB -> bB | cTheorem − Let L be a CFL not containing {s}. Then there exists a GNF grammar G such that L = L(G).Lemma 1 − Let L be a CFL. Then there exists a PDA M such that L = LE(M).Proof ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
6K+ Views
The Chomsky hierarchy is given below −Type 2 − Context Free Grammar (CFG)Type 2 grammars are generated by context free languages.The language that is generated by the grammar is recognized by Push Down Automata.Type 2 must be in Type 1.Left-hand side of production can have only one variable.|alpha| =1There is no restriction on beta.The production rules are in the form of −A->alphaWhere, A is any single non-terminal and is any combination of terminals and nonterminals.ExampleS->ABA->aB->bType 3 − Regular grammarType 3 grammars are generated by regular languages.These languages are exactly all those languages that can be accepted by finite state automata.Type ... Read More