I have a binary tree. I need to write a recursive Java method that will give the longest path between two nodes.
For example, the longest path if the next tree is 7 (7-8-5-13-15-18-16-17).
http://img294.imageshack.us/img294/130/treeb.jpg
How to solve this problem?
(Method: public static int longestPath (Node n))
source
share