Partitions of Leaves in rooted Tree using Dynamic programming
Given a Rooted Tree with n node, labeled from 1 to n and tree is rooted at node 1. Parent of i-th node is p[i], i is starting from 2 as 1 is always root node. Let f(L) denotes the smallest connected subgraph that contains all leaves L. The task is to count the number of ways to… Read More »
