Last active
April 22, 2025 14:34
-
-
Save fabianbaechli/ec065317d914359fc6be151459b95e7f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Iterative | |
BSTreeSearch(p,v) | |
while p ≠ NIL AND p->key≠v do | |
if v<p->key then | |
p = p->lft | |
else | |
p = p->rgt; | |
return p; | |
// Recursive | |
BSTreeSearch(p,v) | |
if p==NIL OR p->key==v then return p; | |
if v<p->key then | |
return BSTreeSearch(p->lft,v) | |
else | |
return BSTreeSearch(p->rgt,v); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment