GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

K centers problem in binary tree

Hi,

I went over the algorithm of K centers problem (Greedy Approximate Algorithm) 

and I want to know what would be the algorithm for marking K nodes in a binary tree.

More details:

If I am given K which represent the number of marked nodes. My algorithm should find these K nodes  such that the maximum distance from any node to its nearest marked ancestor is minimized.

 

 

asked Feb 18 by aurwu
...