- 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
4K+ Views
If Σ is an alphabet, the set of all strings can be expressed as a certain length from that alphabet by using exponential notation. The power of an alphabet is denoted by Σk and is the set of strings of length k.For example, Σ ={0, 1}Σ1= {0, 1} ( 21=2)Σ2= {00, 01, 10, 11} (22=4)Σ3= {000, 001, 010, 011, 100, 101, 110, 111} (23= 8)The set of strings over an alphabet Σ is usually denoted by Σ*(Kleene closure)For instance, Σ*= {0, 1}*={ ε, 0, 1, 00, 01, 10, 11, ………}Therefore, Σ*= Σ0U Σ1U Σ2U Σ3…………. With ε symbolThe set of ... Read More
18K+ Views
Derivation tree is a graphical representation for the derivation of the given production rules of the context free grammar (CFG).It is a way to show how the derivation can be done to obtain some string from a given set of production rules. It is also called as the Parse tree.The Parse tree follows the precedence of operators.The deepest subtree is traversed first. So, the operator in the parent node has less precedence over the operator in the subtree.PropertiesThe properties of the derivation tree are given below −The root node is always a node indicating the start symbols.The derivation is read ... Read More
8K+ Views
ProblemDerive the string"00101" for left most derivation (LMD) and right most derivation (RMD) using context free grammar (CFG).SolutionThe grammar is as follows −S->A1B A->0A| ε B->0B| 1B| εLeft Most derivation (LMD)In the left most derivation, the given input is scanned and then replaced with the production rule from left side to right. So, we have to read that input string from left to right.The grammar is as follows −S->A1B rule1 A->0A| ε rule 2 B->0B| 1B| ε rule 3Hence, the LMD will be as follows −S->A1B ->0A1B rule2 ->00A1B rule2 ->001B rule2 ->0010B rule3 ->00101B rule3 ->00101 rule3 Derived the ... Read More
4K+ Views
Derivation is a sequence of production rules. It is used to get input strings. During parsing, we have to take two decisions, which are as followsWe have to decide the non-terminal which is to be replaced.We have to decide the production rule by which the non-terminal will be replaced.Two options to decide which non-terminal has to be replaced with the production rule are as follows −Left most derivationRight most derivation.Let us understand these two options in detail.Left Most DerivationIn the leftmost derivation, the input is scanned and then replaced with the production rule from left side to right. So, we ... Read More
43K+ Views
A context free grammar (CFG) is a forma grammar which is used to generate all the possible patterns of strings in a given formal language.It is defined as four tuples −G=(V, T, P, S)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
1K+ Views
Some basic difference between a Non-deterministic finite automata (NFA) and Deterministic Finite Automata (DFA) is that in DFA each state has an output for each of the inputs, whereas this is not necessary for NFA.Also, in NFA the input can be \epsilon but in DFA this is not the case.Moreover, in NFA one state can go to a different state on the same output but this is not the case with DFA.Usually, we convert an NFA into a DFA by making the state transition diagram for the given NFA and accordingly vary that state diagram for the DFA. From this ... Read More
46K+ Views
There are two Pumping Lemmas (PL), which are defined for Regular Languages and Context - Free Languages.Pumping lemma for Regular languagesIt gives a method for pumping (generating) many substrings from a given string.In other words, we say it provides means to break a given long input string into several substrings.Lt gives necessary condition(s) to prove a set of strings is not regular.TheoremFor any regular language L, there exists an integer P, such that for all w in L|w|>=PWe can break w into three strings, w=xyz such that.(1)lxyl < P(2)lyl > 1(3)for all k>= 0: the string xykz is also in ... Read More
3K+ Views
Closure property is a technique to understand the class of the resulting language when we are performing an operation on two languages of the same class.That means, suppose L1 and L2 belong to regular language and if regular language is closed under operation ∪, then L1∪L2 will be a Regular language. But if RL is not closed under ∩, that doesn't mean L1∩L2 won't be a RL.For a class to be closed under an operation, it has to hold true for all languages in that class. So, if a class is not closed under an operation, we cannot say anything ... Read More
767 Views
ProblemGenerate RE for a given finite automata by using the state elimination method.SolutionThere are two methods for converting a Deterministic Finite Automata (DFA) to Regular expression (RE).Arden's Theorem Method.State Elimination Method.The given automata is as follows−Step 1Initial state is A that has an incoming edge.So, we have to create a new initial state qi as follows−Step 2Initial state is B that has an incoming edge.So, we have to create a new final state qf as given below−Step 3Now, try to eliminate all intermediate states one by one.First eliminate state AThere is a path from state qi to B via A.So, ... Read More
2K+ Views
ProblemGiven a Finite Automata, we need to convert the Finite Automata into equivalent Regular Expression using the State Elimination Method.Step 1 − Initial state q1 has incoming edge. So, create a new initial state qi.Step 2 − Final state q2 has outgoing edge. So, create a new final state.Step 3 − Start eliminating intermediate states one after another.If there is path going to qi to q2 via q1So after eliminating q1 we can connect a direct path from qi to q2 having costε .c*.a=c*aThere is a loop on q2 using state qiSo after eliminating state q1 we can draw a ... Read More