Page 20 - Algorithms Notes for Professionals
P. 20

b)
















       Output should be true.

       Example:2


       If the inputs are:

       a)


















       b)





















       Output should be false.


       Pseudo code for the same:


       boolean sameTree(node root1, node root2){

       colegiohispanomexicano.net – Algorithms Notes                                                            16
   15   16   17   18   19   20   21   22   23   24   25