I just started programming in general and started with Java, in an assignment I got I need to find the longest increasing path of a binary search tree of integer. however I have no idea how to carry it out. I know how to count the longest path of a binary search tree, just not when you need to find the path that's the longest with the values increasing.
the part I am stuck with is that my code only counts the longest path of the right of the root node
This question is too difficult for "beginning", so I shall move it.
Joined: Mar 13, 2011
out of curiosity what is the cost of find the leaves in a binary tree in big O notation
Stephan van Hulst
Joined: Sep 20, 2010
Here's a tip:
For any binary tree, the length of the longest increasing path would be the length of the longest increasing path of either the left subtree, or the right subtree, whichever is bigger, plus 1 if the path starts at the root of the subtree, and the root of the parent is smaller than the root of the subtree.