how make tree search, if the value of the node is same with the before node then the position is right of the before node.
tree search
Collapse
X
-
-
What you can do if you want to build this algorithm yourself is you should use recursive function to find to the leaf of the tree.Originally posted by tomylinhow make tree search, if the value of the node is same with the before node then the position is right of the before node.
e.g.
TreeSearch(node position)
if this node is not leaf
if this node is less than the value
TreeSearch(left node)
else
TreeSearch(righ tnode)
else //this is the left node then return the node
return this node
Above is just the idea of using recursive function if you don't know, but I think you've already known about it, so it's not hard to implement it yourself hey!
cheer.Comment
Comment