Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Binary Search Tree Search (Recursion) Function
- searchedNode equals the node you're looking for
- currentNode equals the middle of the list
- recursionFunction(searchedNode, currentNode):
- if, list has contents:
- if, searched node equals currentNode:
- inform user the searchedNode is in the list (or do whatever)
- else if, searchedNode is greater than currentNode:
- if, the currentNode has no pointer to a greater number:
- inform user the searchedNode is not in the list (or do whatever)
- else:
- call recursionFunction(searchedNode, currentNode.more)
- else if, searchedNode is less that currentNode:
- if, the currentNode has no pointer to a lesser number:
- inform user the searchedNode is not in the list (or do whatever)
- else:
- call recursionFunction(searchedNode, currentNode.less)
- else:
- inform user that the list is empty
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement