
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 language L accepted by Non-deterministic finite automata (NFA) with ε, denoted by M= (Q, Σ, 𝛿, q0, F) and can be defined as follows −Let M= (Q, Σ, 𝛿, q0, F) be a NFA with εWhere, Q is a set of statesΣ is input setδ is a transition function from Q x { Σ U ε } to 2Qq0 is start stateF is a final stateThe string w in L accepted by NFA can be represented as follows −L(M)={w| w ∈ Σ* and 𝛿 transition for w from q0 reaches to F}ExampleConstruct NFA with epsilon which accepts a language ... Read More

12K+ Views
ProblemConvert the given finite automata (FA) into regular expression (RE).SolutionThere are two popular methods for converting a DFA to its regular expression −Arden’s MethodState elimination methodLet’s consider the state elimination method to convert FA to RE.RulesThe rules for state elimination method are as follows −Rule 1The initial state of DFA must not have any incoming edge.If there is any incoming edge to the initial edge, then create a new initial state having no incoming edge to it.Rule 2There must exist only one final state in DFA.If there exist multiple final states, then convert all the final states into non-final states ... Read More

15K+ Views
ProblemDerive a derivation tree for the string aabbabba for the given context free grammar (CFG) −S->aB|bA A->a|aS|bAA B->b|bS|aBBSolutionDerivation is a sequence of production rules, which is used to get input strings.Derivation treeIt is a graphical representation for derivation of given production rules for a given CFG. It is also called as a parse tree.PropertiesThe derivation tree contains some properties, which are as follows −The root node is always a node indicating the start symbol.The derivation is read from left to right.The leaf node is always terminal nodes.The interior nodes are always the non-terminal nodes.The given CFG is as follows −S->aB|bA ... Read More

3K+ Views
ProblemLet’s consider a grammar to derive “abb” string using LMD and RMD S->AB/ ε A-> aB B-> SbSolutionWe have to use context free grammar.Derivation is a sequence of production rules, which is used to get input strings.During parsing, we have to take two decisions, which are as follows −We have to decide which non-terminal has to be replaced.We have to decide which non-terminal has to be replaced by using which production rule.There are two options to decide which non-terminal has to be replaced with production rule −Leftmost derivationRightmost derivationLeftmost derivationThe input is scanned and replaced with production rules from left ... Read More

5K+ Views
ProblemGenerate the language for the given context free grammar.S->0S, S-> λS-> A0, A->1A, A-> λS->000S, S-> λSolutionContext free grammar (CFG) is a formal grammar that is used to generate all the possible patterns of strings in a given formal language.CFG is defined by four tuplesG=(V, T, P, S)Where, T: Set of terminals (lowercase letters) symbols.V: Vertices or non-terminal symbols (Capital letters).P: Production rules.S: Start symbol.Example 1The grammar is −S->0S, S->λCase 1 − S->0S ->0Case 2 − S->0S ->00S ->00Case 3 − S->0S ->00S ->000S ->000Therefore, the language generated for the given grammar is −L={e, 0, 00, 000……..}Example ... Read More

31K+ Views
We extend the class of NFAs by allowing instantaneous ε transitions −The automaton may be allowed to change its state without reading the input symbol 2.In diagrams, such transitions are depicted by labeling the appropriate arcs with ε.Note that this does not mean that E has become an input symbol. On the contrary, we assume that the symbol E does not belong to any alphabet.ε -NFAs add a convenient feature but (in a sense) they bring us nothing new. They do not extend the class of languages that can be represented.Both NFAs and E-NFAs recognize exactly the same languages.Epsilon (ε) ... Read More

3K+ Views
In Non-Deterministic Finite Automata, for any current state and input symbol, there exists more than one next output state.Any string is accepted if and only if there exists at least one transition path which is starting at initial state and ending at final state.The following steps are followed to convert a given NFA to a DFA −AlgorithmStep-01Let's take ' q’ as a new set of states of the DFA. It is declared null in the beginning.Let's take T’ be a new transition table of the DFA.Step-02Add the start state of the NFA to q’.Add transitions from the start state to ... Read More

17K+ Views
ProblemDesign a Moore machine for a binary input sequence such that if it has a substring 101, the machine outputs A, if the input has substring 110, it outputs B otherwise it outputs C.SolutionFor designing such a machine, we will check two conditions, and those are 101 and 110. If we get 101, the output will be A, and if we recognize 110, the output will be B. For other strings, the output will be C.Moore machine has 6 tuples(Q, q0, Σ, O, δ, λ)Where, Q: Finite set of statesq0: Initial state of machineΣ: Finite set of input symbolsO: Output ... Read More

11K+ Views
Moore machine has 6 tuples, which are as follows −(Q, q0, Σ, O, δ, λ)Where, Q: Finite set of statesq0: Initial state of machineΣ: Finite set of input symbolsO: Output alphabetδ: Transition function where Q × Σ → Qλ: Output function where Q → OThe transition diagram is as follows −ExplanationStep 1 − q0 is the start state on input ‘0’ goes to q1 state and on ‘1’ goes to state q2 generating output 0.Step 2 − q1 on input ‘0’ goes to q1 itself and on ‘1’ goes to q2 generating output ‘1’.Step 3 − q2 on input ‘0’ ... Read More

33K+ Views
ProblemDraw the state transition diagram over an alphabet Σ={a, b} that accepts the string starting with ‘ab’.SolutionThe formal definition of Deterministic Finite Automata (DFA) is as follows −A DFA is a collection of 5-tuples as shown below −M=(Q, Σ, δ, q0, F)Where, Q: Finite set called states.Σ: Finite set called alphabets.δ: Q × Σ → Q is the transition function.q0 ∈ Q is the initial state.The language is generated as given below −L={ab, aba, abab, …….}The transition diagram is as follows −Here, D is a dead state.D is a transition state, which it can never escape. Such a state is ... Read More