O(1) algorithm to determine if node is descendant of another node in a multiway tree?

后端 未结 7 1299
情书的邮戳
情书的邮戳 2021-02-08 04:37

Imagine the following tree:

    A
   / \\
  B   C
 / \\   \\
D   E   F

I\'m looking for a way to query if for example F is a descendant of A (n

7条回答
  •  日久生厌
    2021-02-08 04:55

    Take a look at Nested set model It's very effective to select but too slow to update

提交回复
热议问题