bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_2 / algorithms / algo_057.md

algo_057.md (364B)


      1 # algo_057
      2 
      3 ### Problem Statement
      4 
      5 > Write a recursive algorithm to search an element in a Binary Search Tree (BST).
      6 
      7 ## Algorithm
      8 ```
      9 procedure search(T, key)
     10 begin
     11     if (T = NULL or INFO(T) = key) then
     12         return T;
     13     else if (key < INFO(T)) then
     14         return search(LC(T), key);
     15     else
     16         return search(RC(T), key);
     17     endif
     18 end procedure
     19 ```