Stuck on dynamic programming.

Revision en1, by speedster, 2017-10-04 17:20:27

problem : in a rooted binary tree with n nodes, each node has a positive value( v(i) ) you need to select k(k<=n) nodes from the tree. if a node is selected you must select all of its ancestors.design a dp algo for maximum possible value of k selected nodes

Tags #dp, dynamic programming, #trees, binary tree

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English speedster 2017-10-04 17:20:27 297 Initial revision (published)