Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
Derive the string "abb" for leftmost and rightmost derivation
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 MoreHow to generate the language for context free grammar?
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 MoreExplain NFA with epsilon transition.
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 MoreHow to convert from NFA to DFA in TOC?
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 MoreDesign a Moore machine for some binary input sequence.
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 MoreDesign a Moore machine to generate 1's complement of a binary number.
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 MoreMagnetism, Electromagnetism & Magnetic Materials
MagnetismIn the ancient times, people believed that the invisible forces of magnetism was purely a magical quantity. However, with the increasing scientific knowledge over the passing centuries, magnetism assumed a larger and larger role. Today the magnetism has attained a place of pride in electrical engineering. Without the magnetism, it is impossible to operated electrical devices like generators, motors, transformers, TV, radio, telephone etc. Therefore, electrical engineering is much dependent on magnetism.Magnetic polesA magnet has two poles viz. North Pole and South Pole. In order to determine the polarity of a magnet, suspend it at its centre, then the magnet ...
Read MoreLoaded and Unloaded Voltage Dividers
A voltage divider or potential divider is a series circuit that is used to provide more than one reduced voltages from a single source of voltage.Consider a circuit of voltage divider as shown below, in which two reduced voltages V1 and V2 are obtained from a single input voltage source of V volts. Since no load is connected to circuit, it is called unloaded voltage divider.Refer the circuit of unloaded voltage divider, $$\mathrm{Circuit\:Current, I= \frac{V}{R_{1}+{R_{2}}}=\frac{V}{R_{eq}}}\:\:\:… (1)$$ Where, Req=R1 + R2= Total resistance of voltage dividerTherefore, $$\mathrm{V_{1}=IR_{1}=\frac{V}{R_{eq}}×R_{1}=V\frac{R_{1}}{R_{eq}}}\:\:\:… (2)$$$$\mathrm{V_{2}=IR_{2}=\frac{V}{R_{eq}}×R_{2}=V\frac{R_{2}}{R_{eq}}}\:\:\:… (3)$$Hence, equation (2) and (3) shows that, the voltage drop ...
Read MoreInductors in AC Circuits
Consider the circuit containing a pure inductive coil of inductance L Henry. When an alternating voltage V (RMS) is applied across the coil, an alternating current I (RMS) will flow through the circuit. Due to this alternating current, a back emf (e) is induced in the coil due to inductance of it. This back emf at every instant opposes the any change in current through the coil.Let the applied alternating voltage is$$\mathrm{u=V_{m}sin\:\omega t}\:\:\:… (1)$$The back emf (e) induced in the inductor coil is given by, $$\mathrm{e=L \frac{di}{dt}}\:\:\:… (2)$$Since, there is no ohmic drop, thus the applied voltage has to overcome ...
Read MoreDifference between Diamagnetism, Paramagnetism, and Ferromagnetism
In order to differentiate the diamagnetism, paramagnetism, and ferromagnetism, first we need to understand, the concept of magnetism and diamagnetism, paramagnetism and ferromagnetism individually.Concept of MagnetismElectrons exhibit two types of angular momenta − Orbital Angular Momenta and Spin Angular Momenta . The orbital angular momentum is a property of electrons when they are in atoms while the spin angular momentum is an intrinsic property of electrons. With these angular momenta, a magnetic moment is associated. That magnetic moment is a property which causes the electrons to experience a force, when they are placed in a magnetic field.The orbital magnetic moment ...
Read More