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

Ask a Question

 

Start Coding Today

   

GeeksQuiz

GeeksforGeeksIDE

Data Structures

Algorithms

Interview Experiences

C Programming

C++ Programming

Java Programming

GATE CS

Books

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
...