943,809 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 20531
  • C RSS
Mar 27th, 2004
0

Translate an algorithm to C program

Expand Post »
my problem is that i have written an algorihtm to convert non deterministic finite automata to deterministic finite automata but i couldn't translate it to C program and this is the algorithm i have written
qx is a state in the NFA and q0 is its start state
QX is a state in the DFA and Q0 is its start state
The eqsilon-closure of a DFA state consists of all the states in the NFA that we can get to with epsilon moves from the states in the DFA state.
Q0 = { q0 }
// but there are some states we can reach from q0 at no cost
Q0 = epsilon-closure(Q0)
while there are states we haven't processed
pick one such state, Qn
for each symbol s
let tmp be a new, empty, set
for each q in Qn
add delta(q,s) to tmp
end for
tmp = epsilon-closure(tmp)
if tmp is not in the DFA then
let Qi be a new state
Qi = tmp
add Qi to the DFA
else
let Qi be the state equivalent to tmp
end if
add an edge from Qn to Qi in the automaton
end for
end while
for each Qi
if there is a q in Qi that is a final state then
Qi is a final state
end if
end for
i was wondering if you would mind helping me to translate it to a C program that convert NFA to DFA.

i'm looking forward to getting your answer
Similar Threads
Reputation Points: 11
Solved Threads: 0
Newbie Poster
ayoub is offline Offline
3 posts
since Mar 2004
Mar 28th, 2004
1

Re: Translate an algorithm to C program

is that the psuedo code you want to translate? or is that VB, sorry some times I can't tell the diffrence becuase I'm not well educated about VB.

If its VB you can try posting it in the VB section as well, I bet alot of C programmers who also know VB stop by there.
Reputation Points: 28
Solved Threads: 9
Posting Whiz in Training
BountyX is offline Offline
222 posts
since Mar 2004
Aug 3rd, 2010
-2
Re: Translate an algorithm to C program
dear sit/ madam,

i want all algoritham & flowchat of c programming
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dhaval gajjar is offline Offline
1 posts
since Aug 2010
Aug 3rd, 2010
0
Re: Translate an algorithm to C program
Google for "algorithms in C", for starters, and check out Wikipedia's algorithm's, as well (they have LOTS).

Flowcharts are harder to find, (just not that popular on the internet, I believe), but give all your search engines a shot with that subject matter, as well.

"All", you will never get, but you can get a lot!

Welcome to the forum! If you have any other questions like this, be sure to ask them in a new thread, not somebody else's thread.

@Ayoub:

Hopefully smarter members will give you an answer, but the question is "how far did you get?", and "what has you stumped, now?".

Nice pseudo code, btw. Logic is very clear, I just don't know what the bleep you're referring to! Somehow, in my one semester of programming, this was glossed over!
Last edited by Adak; Aug 3rd, 2010 at 8:35 am.
Reputation Points: 416
Solved Threads: 181
Nearly a Posting Virtuoso
Adak is offline Offline
1,463 posts
since Jun 2008
Jan 9th, 2012
0

weekly timetable of student in tabular form

dear sir/madam
I want flowchart and algorithm related to weekly timetable of student
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rutuja kadlag is offline Offline
1 posts
since Jan 2012
Jan 9th, 2012
0
Re: Translate an algorithm to C program
2 resurrections of a 7 year old thread with "give me the answer" posts show this this thread is a lazy-student magnet.

Closed
Moderator
Reputation Points: 3278
Solved Threads: 892
Posting Sage
WaltP is offline Offline
7,718 posts
since May 2006
This thread is currently closed and is not accepting any new replies.
Previous Thread in C Forum Timeline: want a starting of a problem!!
Next Thread in C Forum Timeline: Compling a C file with Command prompt





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC