bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_2 / algorithms / algo_058.md

algo_058.md (412B)


      1 # algo_058
      2 
      3 ### Problem Statement
      4 
      5 > Write a non-recursive algorithm to search an element in a Binary Search Tree (BST).
      6 
      7 ## Algorithm
      8 ```
      9 procedure search(T, key)
     10 begin
     11     while (T ≠ NULL) do
     12         if (INFO(T) = key) then
     13             return T;
     14         else if (key < INFO(T)) then
     15             T ← LC(T);
     16         else
     17             T ← RC(T);
     18         endif
     19     endwhile
     20     return NULL;
     21 end procedure
     22 ```
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror