[問題] ancestry problem
給一顆 binary tree,
問某個 node 是不是另一個 node 的 ancestor,
要在 constant time 決定。
允許 O(n) 的 preprocessing。
n: # of node
我做了幾次嚐試都失敗,至少要logn,
3 種 traversal,也看不出什麼線索。
thanks
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.115.235.76
→
06/20 15:03, , 1F
06/20 15:03, 1F
→
06/20 15:04, , 2F
06/20 15:04, 2F
推
06/20 15:39, , 3F
06/20 15:39, 3F
→
06/20 15:39, , 4F
06/20 15:39, 4F
→
06/20 15:40, , 5F
06/20 15:40, 5F
→
06/20 15:40, , 6F
06/20 15:40, 6F
推
06/20 16:25, , 7F
06/20 16:25, 7F
討論串 (同標題文章)
以下文章回應了本文 (最舊先):
完整討論串 (本文為第 1 之 15 篇):