just check first for the right child of node if (right*[**x**]** ≠* NIL ) and then first call print method for right child
Algorithm 3 Print(x) 1: if (*x **≠* NIL) then 2: print *colour **[**x**]* 3: if (right*[**x**]** ≠* NIL) then 4: Print (right*[**x**]**)* 5: Print(left*[**x**]*) 6: end if 7: end if On Tue, May 1, 2012 at 3:44 PM, atul anand <[email protected]> wrote: > assignment is not at all tough , i guess you should understand recursion > to solve these question. > for eg : in question 4.1 : you just need to swap line number 4 and line > number 5 to get the solution. > > in question 4.2 , you are given code for counting total number of nodes in > the tree and for counting total number of leaves in the tree. > soo.... dont you think all information is given and you just need to > logically think to find the answer . read about what are internal nodes and > after understanding it see what all question providing you , i hope you can > get the answer. > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
