Partition a Binary Tree

Revision en1, by go_rob, 2017-04-07 17:08:17

Given a binary tree,

We have to remove a single edge and partition the tree into two new trees such that difference of their diameters remains less than a given constant k.

Please suggest me an approach of O(n) time complexity.

Tags dynamic programming, #trees, #dfs

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English go_rob 2017-04-07 17:08:32 0 (published)
en1 English go_rob 2017-04-07 17:08:17 266 Initial revision (saved to drafts)