Блог пользователя Evil__Coder

Автор Evil__Coder, история, 5 лет назад, По-английски

If we have to find the tree with minimum depth. Is it a possible solution??

MY Idea

We find the diameter of a tree using two bfs.(First bfs from any node and second bfs from the farthest node in the first bfs). And the minimum depth tree would be the tree with middle element of diameter as root ( or any of the two node if diameter is even ).

Is there any corner cases in this idea?? Or this approach is totally wrong??

Thanks in Advance (:

Полный текст и комментарии »

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится