Longest path in a tree : DP Trees

Can you please provide the implementation of the code without the use of priority queues. The implementation done by sanyam bhaiya uses priority queues. Please provide the implementation without the use of priority queues.

@aman2382000,
My implementation here

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.

Can you please provide the code in java ?

@aman2382000,
Nope I only know C++, but I don’t think language, would have anything to do with your understanding of the logic for solving the problem. Just, understand how the algorithm works, and then code it yourself in JAVA…
You can use this reference for C++ STL functions used in the code(most of whom purpose is well explained by their name)

Hey @aman2382000
How can I help you ?

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.