Questions tagged [nfa]

An NFA is a nondeterministic finite automaton, a mathematical model of computation that decides membership in regular languages.

An NFA is a nondeterministic finite automaton, a mathematical model of computation that decides membership in regular languages.

It is similar to a DFA except that it is nondeterministic, and the machine can be in multiple states simultaneously. Some definitions of NFAs also allow for e-moves, in which the automaton can transition between states on no input at all.

It is known that for every NFA there is also DFA that expect the same language, thus their computation streangh is identical.

310 questions
-1
votes
1 answer

Why doesn't {a^nb^n | n >= 0} follow regular language closure properties?

Using the pumping lemma, we can prove that {a^nb^n | n >= 0}, but what is not clear is the following. {a^n | n >= 0} is regular by itself and so is {b^n | n >= 0}, and if I am not mistaken, regular languages are closed under concatenation, so why…
user19187727
  • 169
  • 9
-1
votes
3 answers

NFA that does not accept strings ending "101"

What is the NFA that does not accept strings ending "101"?
-1
votes
1 answer

Making NFA of Regex ^[a-zA-Z0-9]{3,16}$

I'm trying to make a NFA of regex ^[a-zA-Z0-9]{3,16}$. I've understood that this regex means the language will only accept strings of length 3 to 16 which may include a to z, A to Z or 0 to 9. I've tried to make this but the main issue I'm facing…
Arbaz Khan
  • 23
  • 3
-1
votes
1 answer

How to convert nfa to dfa

Question in note my solution I find a question in my note and when I try to convert the nfa to a dfa, i get a similar result but not exactly the same. what am i doing wrong? or is my answer also acceptable?
Kent Wong
  • 143
  • 8
-1
votes
2 answers

Is this correct NFA graph?

Task: Build NFA from a given regular expression. I decided to push some of my old programs to GitHub. Specifically problems regarding Theory of formal languages. After testing code I had this result and I can't really tell if this a wrong or correct…
Edwin
  • 51
  • 1
  • 6
-1
votes
1 answer

My program gives the correct output in windows(gcc) but in Linux(gcc) it leads to segmentation fault

This program is to find the epsilon closure of all states of an NFA. I have used the stack to get this done.The program gives the right output when I compiled it using gcc and ran it Windows 10(Command Prompt). But when I compiled with the same…
Akhil V
  • 53
  • 10
-1
votes
1 answer

Trying to draw a Non- Deterministic Finite Automata

I'm completely new to finite automata and kind of struggling to understand the topic. I'm able to draw simple ones but I have a practice question that asks to: Design a Non- Deterministic Finite Automata that accepts ∑={0,1}. The Non-Deterministic…
John Diggle
  • 21
  • 1
  • 7
-1
votes
1 answer

How to construct an NFA in C++ that supports transitions that go back to an already visited state?

I am trying to construct an NFA from a text file with the format: state 1 start state 2 state 3 accept transition 1 0 2 transition 1 1 3 transition 2 0 1 transition 2 0 3 where state is: state [state #] [start or…
-1
votes
1 answer

Understanding epsilon closure algorithm pseudocode

The following pseudocode is from Introduction to Compiler Construction in a Java World book. This algorithm is supposed to output the epsilon closure of a set of a states of a nondeterministic finite machine (to convert it to a deterministic one…
Algo
  • 841
  • 1
  • 14
  • 26
-1
votes
1 answer
-1
votes
1 answer

What will be the e-closure(r) in following NFA

Sorry guys I cannot provide the pic here...I was unable to upload the pic...so.. I will give the transition table of the problem. (S/I)....a...b.....c.......e(elipson) p>.......{p}.....{q}...{r} ..¤(phi) q>.......{q} ....{r} ..¤.... {p}…
-1
votes
1 answer

Mapping power state to unique number NFA to DFA

I am writing the code to convert NFA to DFA, if we have a power state {1,2,4}, I have to convert it into the some unique number, say x. Also I have to do the reverse mapping such that is I get x, I have to return the power state as {1,2,4} I came up…
Vallabh Patade
  • 4,960
  • 6
  • 31
  • 40
-1
votes
1 answer

How to convert a context free grammar (could generate regular language) to a right-linear grammar

The context free grammar: (e represents epsilon) S --> aSb|aSa|bSa|bSb|e It could generate regular language which means it can be converted to a right linear grammar. Is there a general rule to convert CFG into a RLG?
henry
  • 185
  • 2
  • 2
  • 13
-1
votes
2 answers

How can I tell a regular language?

As we know, using pumping lemma, we can easily prove the language L = {WW|W ∈ {a,b}*} is not a regular language. However, The language, L1 = {W1W2| |W1| = |W2|} is a regular language. Because we can get the DFA like below, My question is, L = {WW|W…
henry
  • 185
  • 2
  • 2
  • 13
-2
votes
1 answer

By writing a regular expression or a grammar, describe the language accepted by the NFA

NFA diagram the strings accepted are aaaaa which is pretty clear. The L = (111 + 1111)* is what I am getting but I need it in regular expression or grammar
coding12
  • 1
  • 1
1 2 3
20
21