- 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 1259 Articles for Computers
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
5K+ 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 such 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 LThere 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 use of reducing grammar is as follows −DefinitionA symbol X is useful if there is ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
3K+ Views
CFG stands for context free grammar and CNF stands for Chomsky’s Normal Form in the theory of computation.Context Free Grammar (CFG)A context free grammar (CFG) is a forma grammar which is used to generate all possible patterns of strings in a given formal language.It is defined as four tuples −G=(V, T, P, S)Where, G is a grammar, which consists of a set of production rules. It is used to generate the strings of a language.T is the final set of terminal symbols. It is denoted by lower case letters.V is the final set of non-terminal symbols. It is denoted by ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
9K+ Views
Chomsky’s Normal Form Stands as CNF.A context free grammar is in CNF, if the production rules satisfy one of the following conditionsIf there is start Symbol generating ε. Example − A-> εIf a non-terminal generates two non-terminals. Example − S->ABIf a non-terminal generates a terminal. Example − S->aExampleLet's take G1 Production rules, as given below −G1={ S->AB, S->c, A->a, B->b}G1 satisfies the rule specified for CNF. So, it is in CNF.Now, let's consider G2 production rules, as shown belowG2={ S->aA, A->a, ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
1K+ Views
A context free grammar (CFG) is a forma grammar which is used to generate all possible patterns of strings in a given formal language.It is defined as four tuples −G=(V, T, P, S)Where, G is a grammar, which consists of a set of production rules. It is used to generate the strings of a language.T is the final set of terminal symbols. It is denoted by lower case letters.V is the final set of non-terminal symbols. It is denoted by capital lettersP is a set of production rules, which is used for replacing non-terminal symbols (on the left side of ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
2K+ Views
A decision problem Q is a set of questions, each having either yes or no answer. Let us consider the question is “is 10 a perfect square?” which is an example for a decision problem. A decision problem generally consists of an infinite number of related questions.ExampleThe problem PSQ which determines whether an arbitrary natural number is a perfect square or not having some doubtful questions like the following −q0: Is 0 a perfect square?q1: Is 1 a perfect square?q2: Is 2 a perfect square?SolutionA solution to a decision problem Q is an algorithm which determines the approximate answer to ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
11K+ Views
The Instantaneous description is called as an informal notation, and explains how a Push down automata (PDA) computes the given input string and makes a decision that the given string is accepted or rejected.The PDA involves both state and content of the stack.Stack is often one of the important parts of PDA at any time.So, we make a convenient notation for describing the successive configurations of PDA for string processing.The factors of PDA notation by triple (q, w, γ) wereq is the current state.w is the remaining input alphabet.γ is the current contents of the PDA stack.Generally, the leftmost symbol ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
53K+ Views
DFA is the short form for the deterministic finite automata and NFA is for the Non-deterministic finite automata. Now, let us understand in detail about these two finite automata.DFAA Deterministic Finite automata is a five-tuple automata. Following is the definition of DFA −M=(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.NFANFA also has five states same as DFA, but with different transition function, as shown follows −δ: Q X Σ ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
23K+ Views
Automaton is nothing but a machine which accepts the strings of a language L over an input alphabet Σ. There are four different types of Automata that are mostly used in the theory of computation (TOC). These are as follows − Finite-state machine (FSM). Pushdown automata (PDA). Linear-bounded automata (LBA). Turing machine (TM). When comparing these four types of automata, Finite-state machines are less powerful whereas Turing machines are more powerful. Note − Deterministic Finite Automata (DFA) and the Non-Deterministic Finite Automata (NFA) have the same power because every DFA ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
4K+ Views
A grammar can be unambiguous, if the grammar does not contain ambiguity. This means if it does not contain more than one left most derivation (LMD) or more than one right most derivation (RMD) or more than one parse tree for the given input string, it is an unambiguous grammar.RulesTo convert the ambiguous grammar to the unambiguous grammar, we apply the following rules −Rule 1 − If the left associative operators (+, -, *, /) are used in the production rule, then apply left recursion in the production rule. Left recursion is nothing but left most symbol on the right side ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
719 Views
For each of the following languages, draw the finite automata (FA) accepting it.{a, b}*{a}The language states that the automata accept the strings containing any number of a's and b's and finally ending in a.The finite state automaton for the language is as follows −{a, b}*{b, aa}{a, b*}The language states that the automata accept the strings starting and ending with any number of a's and b's and containing any of the substrings b and aa.The finite state automaton for the language is a follows −{bbb, baa}*{a}The language states that the automata accept the strings containing any number of bbb's and baa's ... Read More