
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 282 Articles for Data Structure Algorithms

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

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

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

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

21K+ Views
Non-deterministic finite automata also have five states which are same as DFA, but with different transition function, as shown follows −δ: Q X Σ -> 2QNon-deterministic finite automata is defined as a 5 tuple, M=(Q, Σ, δ, q0, F)Where, Q: Finite set of statesΣ: Finite set of the input symbolq0: Initial stateF: Final stateδ: Transition function: Q X Σ -> 2QProblemDesign a transition diagram and table for the given language that accepts all strings of length at least 2.SolutionBefore proceeding to the solution, let’s understand what do you mean by length of string and how to find the length of ... Read More

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

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

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

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