@vishal : as discussed in previous post , your solution wont work for certain test cases...and i dont think so , checking tree in inorder way is complex .It is simple to implement , you just need to call tree recursively in Inorder way and keep track of prev node and compare prev node with current node if prev node < current then fine move ahead or report fail.
On Tue, Nov 6, 2012 at 12:39 PM, vishal chaudhary <[email protected]>wrote: > hi all, > yes you can do it that way, but the thing is why are you increasing the > complexity of the problem by again checking the inorder traversal output to > be checked for increasing order. > just traverse through the ones recursively(as we do it in the inoder > traversal) through all the nodes and check whether the left child is less > than the root and root is smaller than the right node. > > > Warm Regards > Vishal Chaudhary > BE(Hons) Computer Science and Engineering > BITS Pilani > > > > > > > On Tue, Nov 6, 2012 at 12:34 AM, shady <[email protected]> wrote: > >> Hi, >> Can we check this by just doing an inorder traversal, and then checking >> if it is in increasing order or not ? >> >> -- >> 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. > -- 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.
