Dude....the question was to find the two nodes also for which the maximum distance exists.....in ur code there is nothing as such....kindly read the question carefully before posting...
On 5/31/11, bittu <[email protected]> wrote: > HI All Yes It The Diameter of BT .& Can be done in O(N) after > optimization > have a look...http://shashank7s.blogspot.com/2011/05/wap-to-find- > diameter-of-binary-tree.html & let me know if still we can improve it > or any test cases for its failing > > Algo given by piyush has TC O(N^2) > Algo given by Ankit Sambyal is seems to good idea.& has TC O(n) as I > think but haven't tested for many cases ..so will try to impl this > algo as well.. > > you know what we can do after getting recursive O(n) Solution is ..it > will be awesome if this problem can solved in iterative way..:isn't > it.. > > Correct me if am wrong..?? > > Thanks > Shashank>>"The Best Way to Escape From The Problem is To Solve It " > CSE,BIT Mesra > > -- > 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. > > -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=100000655377926 * -- 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.
