Found 700 Articles for Computer Science

What is the Halting Problem in TOC?

Bhanu Priya
Updated on 14-Jun-2021 11:46:08

22K+ Views

Usually, programs consist of loops that are limited or unlimited in length.The total work done by the program completely depends on the input given to the program.The program may consist of several different numbers of loops that may be in linear or nested manner.The Halting Problem is the problem of deciding or concluding based on a given arbitrary computer program and its input, whether that program will stop executing or run-in an infinite loop for the given input.The Halting Problem tells that it is not easy to write a computer program that executes in the limited time that is capable ... Read More

Design Turing machine for multiplication

Bhanu Priya
Updated on 14-Jun-2021 11:44:07

8K+ Views

A Turing machine is a seven tuples(Q, Σ, Γ, δ, q0, qacc, qrej)Where, Q is a finite set of states;Σ is the input alphabet does not contain the blank symbol t;Γ is the tape alphabet, where t ∈ Γ and Σ ⊆ Γ;δ: (Q × Γ) → (Q × Γ × {L, R}) is the transition function;q0 ∈ Q is the start state;qacc ∈ Q is the accept state;qrej ∈ Q is the reject state, where qrej ≠ qacc.ProblemConstruct Turing machine (TM) for multiplication of two unary integers.SolutionMultiplication of two unary integers 3*2=6 In Turing Machine 3 represents − 111 ... Read More

How to generate regular expression from finite automata?

Bhanu Priya
Updated on 16-Jun-2021 14:58:05

1K+ Views

There are two methods for converting deterministic finite automata (DFA) to Regular expression (RE). These are as follows −Arden’s MethodState Elimination MethodLet us understand these methods in detail.Arden’s TheoremLet P and Q be the two regular expressions.If P does not contain null string, then following equation in R, viz R = Q + RP,Which has a unique solution by R = QP*Here,The finite Automata do not have epsilon movesIt must have only initial state q1It’s states are q1, q2, q3,…….qn. The final state may be some qi where i

Explain the Star Height of Regular Expression and Regular Language

Bhanu Priya
Updated on 12-Jun-2021 11:58:55

354 Views

The star height of Regular expression (RE) is nothing but the depth of Kleene stars in the theory of computation (TOC).For example, a+b the star height is 0(a+b)* the star height is 1(a*+b*)* the star height is 2 …….Star height is used to indicate the structural complexity of regular languages and expressions.The regular expressions may have different star height that depends on structural complexity or nesting.The star height of a regular language is a unique number and that is equal to the least star height of any regular expression which represents that language.The star height of regular expressions is a ... Read More

How to convert FA to Left Linear Grammar in TOC?

Bhanu Priya
Updated on 12-Jun-2021 11:55:37

3K+ Views

A grammar with at most one variable at the right side of production is called linear grammar.Following is an example of the linear grammar −S→aSb/εHere, if you observe, we can write the same production by dividing …..S→AbA→aAbA→εLeft Linear GrammarA grammar is left linear grammar where all non-terminals in the right hand sides are at the left end.For example, A→Sa/εSteps for conversionThe steps for the conversion of finite automata (FA) to the left linear grammar are as follows −Step 1 − Take reverse of the finite automataStep 2 − write right linear grammarStep 3 − Then take reverse of the right ... Read More

How to convert FA to Right Linear Regular Grammar?

Bhanu Priya
Updated on 12-Jun-2021 11:53:24

4K+ Views

A grammar with at most one variable at the right side of production is called linear grammar.Example 1      S→aSb/εExample 2      S→Ab      A→aAb      A→εRight Linear GrammarA grammar is right linear grammar where all the non terminals in the right hand sides are at the right end.For example,       S->aS/εAlgorithm for conversionThe algorithm to convert the finite automata (FA) to the right linear grammar is as follows −Step 1 − Begin the process from the start state.Step 2 − Repeat the process for each state.Step 3 − Write the production as the ... Read More

How to identify if a language is regular or not in TOC?

Bhanu Priya
Updated on 12-Jun-2021 11:51:15

4K+ Views

To identify whether a language is regular or not, is based on Pigeon Hole Principle. This is generally called as the Pumping Lemma.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.It gives the necessary condition(s) to prove a set of strings is not regular.But the pumping lemma is a contradiction test. This means if any language does not satisfy pumping lemma, then we can say that it is not regular. However, if it satisfies the ... Read More

What is The Church-Turing Thesis in TOC?

Bhanu Priya
Updated on 12-Jun-2021 11:49:05

21K+ Views

The Church-Turing thesis says that every solvable decision problem can be transformed into an equivalent Turing machine problem.It can be explained in two ways, as given below −The Church-Turing thesis for decision problems.The extended Church-Turing thesis for decision problems.Let us understand these two ways.The Church-Turing thesis for decision problemsThere is some effective procedure to solve any decision problem if and only if there is a Turing machine which halts for all input strings and solves the problem.The extended Church-Turing thesis for decision problemsA decision problem Q is said to be partially solvable if and only if there is a Turing ... Read More

Eliminate epsilon, unit and useless symbols and rewrite into CNF

Bhanu Priya
Updated on 12-Jun-2021 12:15:02

689 Views

ProblemEliminate epsilon, unit and the useless symbols for the given grammar and rewrite it into CNF.S->0E0|1FF| εE->GF->S|EG->S| εSolutionIn the given grammar, we will first remove the null production. There are two null productions in the grammar, as given below −S ==> εG ==> εSo, remove null production and rewrite all the other rules containing G by epsilon there, along with old productions. We do not remove S ==> epsilon as it is the start symbol.Remove G ==> epsilon, we get the following −S ==> 0E0 | 1FF | εE ==> G | εF ==> S | EG ==> SNow remove ... Read More

Generate a CNF for a given context free grammar

Bhanu Priya
Updated on 12-Jun-2021 12:12:15

748 Views

ProblemGenerate a Chomsky normal form (CNF) for the following context free grammar (CFG).S->aAa|bBb|eA->C|aB->C|bC->CDE|eD->A|B|abSolutionFollow the steps mentioned below to generate a CNF for the given CFGStep 1 − Eliminate ∧ -productionsWe can delete, erase or ∧ -productions double time repeated.S --> aAa | bBb | ∧A --> a | ∧B --> b | ∧D --> A | B | abStep 2 − Eliminate unit productions in above grammarEliminate R.H.S one symbol productionsS --> aDa | bDbD --> a | b | abStep 3 − Eliminate useless symbolsE is a useless symbol from given grammar since it is not derivative in RHS.S ... Read More

Advertisements