title: Algorithms-how to find a subset in weighted binary tree that maximises weight and no pair of nodes have parent-child relationship
body: <p>So i am on my algorithms and complexity homework  and there is an exercise that's a pain. i have a binary tree with  weight labels(integers) on each node and an integer k and i have to find a subset of the nodes containing at most k nodes , that maximizes the sum of weights and no pair of nodes in the subset have parent-child relationship .  I am supposed to utilize dynamic programming to solve that . </p>
  
  <p>So as a first notion i was thinking of checking the sum of  all the subsets with cardinality 2 ( that have the required property ) , and scale to cardinality k using the subproblems to construct the solution . i have problems all the way though .  Any thoughts ? </p>