Find number of different sub trees of size less than or equal to k
Answers
Answered by
0
Let us create a slightly bigger tree like below.
1
/ | \
2 3 \
/ 4
7 / \
5 6
Let us define a function F(a, k), such that for each node 'a' we create F(a, k) sub-trees when we remove 'k' edges from node ‘a’ and below. (If 'a' is not root, it is assumed to be connected to it's parent).
as a com lover
1
/ | \
2 3 \
/ 4
7 / \
5 6
Let us define a function F(a, k), such that for each node 'a' we create F(a, k) sub-trees when we remove 'k' edges from node ‘a’ and below. (If 'a' is not root, it is assumed to be connected to it's parent).
as a com lover
Similar questions