asdasdqwer's blog

By asdasdqwer, history, 8 months ago, In English

Hello,

could anyone please explain me the intuition behind the solution of CSES-Network Renovation?

The solution to the task

Why does this greedy strategy suffice for connecting the entire tree?

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

You can understand the intuition of the solution in intuition.

The gist of it is by adding k/2 we are guaranteed to have the nodes belong to different subtrees.

Hope this helps.