Write an algorithm to find the “next” node(i.e., in-order successor) of a given node in a binary search tree. (You may assume that each node has a link to its parent or you can get the root node)
how to solve
“Next” node means that the most nearest parent node which is right side of a given node. So we should find it.
When I can get the root node
When I get the parent node of each node