
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 1163 Articles for Computers

7K+ 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

5K+ Views
Chomsky Hierarchy represents the class of languages that are accepted by the different machines.Chomsky hierarchyHierarchy of grammars according to Chomsky is explained below as per the grammar types −Type 0. Unrestricted grammars Turing Machine (TM)Type 1. Context-sensitive grammars Linear Bounded Automaton (LBA)Type 2. Context-free grammars Pushdown Automaton (PDA)Type 3. Regular grammars Finite Automaton (FA)Type-1 Context Sensitive Grammar (CSG)Type 1 grammar is also known as context sensitive grammarThe context sensitive grammar is used to represent context sensitive languageThe CSG follows some rules, which are as follows −The context sensitive grammar may have more than one symbol on the left hand side ... Read More

11K+ Views
Chomsky Hierarchy represents the class of languages that are accepted by the different machines.Chomsky hierarchyHierarchy of grammars according to Chomsky is explained below as per the grammar types −Type 0. Unrestricted grammars Turing Machine (TM)Type 1. Context-sensitive grammars Linear Bounded Automaton (LBA)Type 2. Context-free grammars Pushdown Automaton (PDA)Type 3. Regular grammars Finite Automaton (FA)Type-0 unrestricted grammarType-0 grammars generate recursively enumerable.In type-0 the production has no restrictions.There may be any phase structure grammar which includes all formal grammarsThey generate the language which is recognized by the Turing machine.The productions can be in the form of a->b where, a is a string ... Read More

6K+ Views
Pushdown Automata (PDA) are the finite automata (FAs), but with the ability to push and pop symbols to/from a stack.PDA accepts strings if there is a legal path from start state to acceptance state for input. Otherwise, the string is rejected.A PDA can be represented by a 7-tuple(Q, ∑, ℾ, q0, ha, ∆, δ)WhereThe PDA is to finite subsets of Q ☓ (ℾ ∪ {∆})*.Parentheses are balanced ifWhile reading string, number of opening parentheses >= number of closing parentheses.When string is read, number of opening parentheses = number of closing parentheses.Examples(())() − Balanced((()() − Not balanced)()(() − Not balancedThe context ... Read More

519 Views
Finite automata is an abstract computing device. It is a mathematical model of a system with discrete inputs, outputs, states and a set of transitions from state to state that occurs on input symbols from the alphabet Σ.Formal definition of Finite AutomataFinite automata is defined as a 5-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.Consider the Oyster card barriers at tube stations −States −ClosedOpenTransitions −Swipe cardEnter gateSuccess − Will ... Read More

1K+ Views
ProblemGenerate the push down automata (PDA) that recognizes the language E={aibj| i is not equal to j and I is not equal to 2j}.SolutionConsider the two languages as given below −L1={aibj|i,j>=0 and i>2j}L2={aibj|i,j>=0 and iaA A->aaAb|aA|epsilonIn L2, the number of a's are less than double the number of b'sSo the CFG for L2 becomes as follows − S2->Bb|aBb B->Bb|aBb|aaBb|epsilon S->S1|S2L1: {aibj:i>2j}L2:{aibj: i

11K+ Views
All grammars are not always optimized, which means the grammar may consist of some extra symbols (non-terminals) which increase the length of grammar.So, we have to reduce the grammar by removing the useless symbols.PropertiesThe properties to reduce grammar are explained below −Each non-terminal and terminal of G appears in the derivation of some word in L.There should not be any production as X->Y where X and Y are non-terminals.If epsilon is not in language L then there need not be in the production X-> ε.The diagram given below depicts the use of reduce grammar−The productions of type S-> ε are ... Read More

2K+ Views
The instantaneous description (ID) of a push down automata (PDA) is represented by a triple (q, w, s)Where, q is the state.w is unconsumed input.s is the stack contents.ID is an informal notation of how a PDA compares an input string and makes a decision that string is accepted or rejected.Turnstile NotationIt is used for connecting pairs of ID's that represent one or more moves of a PDA.The process of transition is denoted by the turnstile symbol "⊢"⊢ it represents one move.⊢ sign describes a sequence of moves.Example(P, b, T) ⊢ (q, w, a)While taking a transition from P to ... Read More

618 Views
Context Free Grammars (CFG) are definitely recognized by Non-deterministic push down automata (NPDA), but Programming languages are translated to binary (Machine Code) via Deterministic PDA.This is because it has the following below mentioned impacts −If Programming languages were supposed to be translated via NPDA then for one given program instance we will have multiple versions of binary(Machine code) generated for the same program, which ideally shouldn't be the scenario.For a given program only 1 version of binary code should be generated and that should remain consistent across all OS Platforms.Outputs will vary significantly: If we have multiple object files, then ... Read More

290 Views
ProblemDefine the language, E={aibj|i not equal to j and i not equal to 2j} and design an unambiguous context free grammar (CFG) in Chomsky normal form (CNF) that generates E.SolutionThe unambiguous CFG for the given language is as follows −S->AC|CBA->aA|aB->Bb|bC->aCb|aaCb|epsilonNow, convert this CFG into CNF. You can follow the below mentioned steps for the successful conversion.Step 1First add a new start symbol S0 S0->S S->AC|CB A->aA|a B->Bb|b C->aCb|aaCb|epsilonStep 2Next eliminate the epsilon symbol in the production other than the start symbol. C->epsilon is a null productionAfter eliminating null production, the new productions are as follows − S0->S S->AC|CB A->aA|a B->Bb|b ... Read More