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_047.md

algo_047.md (289B)


      1 # algo_047
      2 
      3 ### Problem Statement
      4 
      5 > Write a recursive algorithm for preorder traversal of a binary tree.
      6 
      7 ## Algorithm
      8 ```
      9 procedure preorder(ptr)
     10 begin
     11     if (ptr ≠ NULL) then
     12         write(INFO(ptr));
     13         preorder(LC(ptr));
     14         preorder(RC(ptr));
     15     endif
     16 end procedure
     17 ```