Graph Theory37 sections · 1633 units
Open in Course

Quiz: Two-BFS Method

Knowledge check

Check Your Understanding

Two-BFS diameter algorithm: BFS from any node aa, find farthest node bb, BFS from bb, find farthest node cc. Distance bb to cc is the diameter. Why does this work?

  1. A.It only works for binary trees
  2. B.BFS always finds diameter endpoints
  3. C.You need three BFS calls, not two
  4. D.The farthest node from any node must be a diameter endpoint
Start the roadmap to answer the quizzes and solve the challenges