bsc

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

root / semester_2 / algorithms / algo_060.md

algo_060.md (504B)


      1 # algo_060
      2 
      3 ### Problem Statement
      4 
      5 > Write an algorithm to check whether two given binary trees are identical or not.
      6 
      7 ## Algorithm
      8 ```
      9 procedure identicalTree(T1, T2)
     10 begin
     11     /* T1 and T2 hold the base addresses of the trees */
     12     if (T1 = NULL and T2 = NULL) then
     13         return true;
     14     endif
     15     if (T1 = NULL or T2 = NULL) then
     16         return false;
     17     else
     18         return ((INFO(T1) = INFO(T2)) and identicalTree(LC(T1), LC(T2)) and identicalTree(RC(T1), RC(T2)));
     19     endif
     20 end procedure
     21 ```
© 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