Found 345 Articles for Data Structure Algorithms

Construct DFA with Σ= {0,1} accepts all strings with 0.

Bhanu Priya
Updated on 11-Jun-2021 13:47:32

27K+ Views

A Deterministic Finite automata (DFA) is a collection of defined as a 5-tuples and is as follows −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.Example 1The DFA accepts all strings starting with 0The language L= {0, 01, 001, 010, 0010, 000101, …}In this language, all strings start with zero.Transition diagramThe transition diagram is as follows −ExplanationStep 1 − q0 is the initial state on input ‘0’ it goes to q1, which is the ... Read More

Explain Deterministic Finite Automata in TOC.

Bhanu Priya
Updated on 11-Jun-2021 13:44:58

16K+ Views

DFA refers to deterministic finite automata. Deterministic refers to the uniqueness of the computation. The finite automata are deterministic FA, if the machine reads an input string one symbol at a time.In DFA, there is only one path input from the current state to the next state. It does not accept the null move, i.e. it cannot change state without any input. It can contain multiple final states. It is used in Lexical Analysis in compilers.Formal definition of different automata (DFA)A Deterministic Finite automata (DFA) is a collection of defined as a 5-tuples and is as follows −M=(Q, Σ, δ, ... Read More

What are different types of finite automata?

Bhanu Priya
Updated on 11-Jun-2021 13:41:23

11K+ 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.TypesThe different types of Finite Automata are as follows −Finite Automata without outputDeterministic Finite Automata (DFA).Non-Deterministic Finite Automata (NFA ... Read More

What is finite automata?

Bhanu Priya
Updated on 11-Jun-2021 13:38:53

14K+ 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 Σ.Finite Automata RepresentationThe finite automata can be represented in three ways, as given below −Graphical (Transition diagram)Tabular (Transition table)Mathematical (Transition function)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 ... Read More

Explain the different operations on Regular language in TOC.

Bhanu Priya
Updated on 11-Jun-2021 13:30:35

12K+ Views

A language is a set of strings from some alphabet (finite or infinite). In other words, any subset L of E* is a language in TOC.Some special languages are as follows −{} The empty set/language, containing no string.{s} A language containing one string, the empty string.ExamplesE = {0, 1}L = {x | x is in E* and x contains an even number of 0’s}E = {0, 1, 2, ., 9, .}L = {x | x is in E* and x forms a finite length real number}= {0, 1.5, 9.326, .}E = {a, b, c, ., z, A, B, ., Z}L ... Read More

What are the different operations performed on strings in TOC?

Bhanu Priya
Updated on 11-Jun-2021 13:28:26

5K+ Views

A string is a finite set sequence of symbols choosen from some alphabets.For example, 00011001 is a string from binary alphabet Σ={0, 1}aabbcabcd is a string from alphabet Σ={a, b, c, d}The different operations performed on strings are explained below −Concatenation.Substring.Kleen star operation.Reversal.ConcatenationConcatenation is nothing but combining the two strings one after another.ExampleLet’s consider two strings −X= TutorialsY= PointThe concatenation (X, Y) of two strings is −X.Y = TutorialsPointNote − Concatenation of empty string with other string gives string itself.For example, X. ε = ε.X = XSubstringIf ‘w’ is a string then ‘v’ is substring of ‘w’ if there exists ... Read More

What is a finite state machine in TOC?

Bhanu Priya
Updated on 11-Jun-2021 13:25:59

7K+ Views

A finite state machine has a set of states and two functions called the next-state and output function.The set of states correspond to all the possible combinations of the internal storage. If there are n bits of storage, there are 2n possible states.The next state function is a combinational logic function that, given the inputs and the current state, determines the next state of the system.The diagram given below explains the functioning of a finite state machine in TOC.The output function generates a set of outputs from the current state and the inputs.TypesThe two types of finite state machines are ... Read More

Explain the power of an alphabet in TOC.

Bhanu Priya
Updated on 11-Jun-2021 13:22:31

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

What is a Derivation tree in TOC?

Bhanu Priya
Updated on 11-Jun-2021 13:13:27

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

Derive the string “00101” using LMD and RMD while using CFG

Bhanu Priya
Updated on 11-Jun-2021 13:14:42

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

Advertisements