Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 20 Online
OpenStudy (anonymous):

I have three algorithms for computing the reflexive transitive closure of R* R*={(a,b): a,b ε A and there is a path from a to b in R} Algorithm #1 Initially R*:= 0 for i=1,.....,n do for each tuple(b1,....,bi) ε A^i do if(b1,....,bi) is a path in R then add (b1,bi) to R* Algorithm #2 Initially R* := R U {(ai,ai) :ai ε A} while there are three elements ai,aj,ak ε A such that (ai,aj),(aj,ak)ε R* but(ai,ak) not ε R* do: add(ai,ak) to R*

OpenStudy (anonymous):

Algorithm #3 Initially R* := R U {(ai,ai): ai ε A } for each j=1,2,....,n do for each i=1,2,....,n do if(ai,aj),(aj,ak) ε R* but (ai,ak) not ε R* then add (ai,ak) to R* Could you please explain those algorithms to me and send a code(in java or c) for each of them? Thank you!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!