Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

breadth first search: BFS(G, s) { initialize vertices; Q = {s}; // Q is a queue (duh); initialize to s while (Q not empty) { u = RemoveTop(Q); for each v  u->adj { if (v->color == WHITE) v->color = GREY; v->d = u->d + 1; v->p = u; Enqueue(Q, v); } u->color = BLACK; } }

OpenStudy (anonymous):

@rebeccaskell94 here is one algorithm :)

OpenStudy (anonymous):

nice implication.. you can also try it with 2d arrays ;)

OpenStudy (anonymous):

yes i know but it'll be tough and besides its just an algorithm :)

OpenStudy (anonymous):

yeahp, but from my experience, i found it much easier when i tried to represent graphs as 2d arrays...

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!
Latest Questions
Arriyanalol: i need help
2 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
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!