Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. 4)
  2. BFS:
  3. Step 1: 1:=0
  4. Q: 2,4,3
  5. Step 2: 2:=1
  6. Q: 4,3
  7. Step 3: 4:=1
  8. Q: 3
  9. Step 4: 3:=1
  10. Q: 6,5
  11. Step 5: 6:=2
  12. Q: 5
  13. Step 6: 5:=2
  14. Q: ∅
  15. 7)
  16. Algorithm for detecting cycles in undirected graph:
  17. - Enqueue starting vertex
  18. - For as long as there are vertices in the queue:
  19. -
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement