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

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

Hello, all. I was studying properties of the ancestors in the tree and solved a problem of finding the kth ancestor of any node in O(logK) time by pre-computing 2^jth parent of every node in O(NlogN) time. I am curious to know how can I apply this knowledge to find LCA of 2 given nodes efficiently?

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