[algogeeks] Print the diameter of a binary tree

2014-04-18 Thread pawan yadav
Hi All, I know how to find the diameter of given binary tree but i don't know how to print the diameter (this longest path). Can somebody please give a code snippet for this? Thanks, Pawan. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

[algogeeks] Max difference of Monotonic Pair in An Array

2014-04-18 Thread Tushar Kanta Rath
Hi All, Can anyone help me solving this problem ? Given a non-empty array A consisting of N integers. Find Max(j-i), s.t 0=i=jN and A[i]=A[j] Here (i, j) is a Monotonic Pair, satisfying the above condition. Space Complexity : O(n) Time Complexity: O(n) -- Regards... -- You received this