HOLI - Spoj, Pigeonhold + Graphs

How can I get the final arrangement of the tree? What if maximised tree cost was not asked but the tree arrangement of the maximised distance is asked?

Hey @Anshul-Chauhan-10221922864290257
While your question is interesting printing the final configuration won’t be asked in a question like this primarily because the complexity of printing such configuration will be around O(n^3) or maybe more and too complex to implement as well. For each edge you can see how which nodes are on either sides of the edge then exchange the min on both sides and so on. This will actually be very complex to understand and explain via this forum. If you still want to talk about it in detail you can send a message via chat and we can discuss it there.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.