Skip to content

Instantly share code, notes, and snippets.

@ButlerFuqua
Created April 12, 2021 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ButlerFuqua/934b7b1f6bcf897409a7d5759e7503d1 to your computer and use it in GitHub Desktop.
Save ButlerFuqua/934b7b1f6bcf897409a7d5759e7503d1 to your computer and use it in GitHub Desktop.
BSTSearch(tree, key) {
cur = tree->root
while (cur is not null)
if (key == cur->key)
return cur // Found
else if (key < cur->key)
cur = cur->left
else
cur = cur->right
return null // Not found
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment