Re: [algogeeks] Is max distance between two leaves(diameter) in a tree is equal to max distance between any two node in that tree??

2012-06-25 Thread atul anand
consider a case where tree is right skewed or left skewed , in dat case max distance b/w two node found are root and leftmost or rightmost node(left or right skewed) . so its not alwayzz true On Sun, Jun 24, 2012 at 5:08 PM, Navin Kumar algorithm.i...@gmail.comwrote: -- You received this

[algogeeks] Find the Pair of X,Y [ 1/x + 1/y = 1/N! ]

2012-06-25 Thread Roshan
Few Months back I found the problem on Code Sprint 1/x + 1/y = 1/N! (N factorial). For large value of N we have to find the par of (X,Y) which satisfy the equation my sol was slow , can any pleas help me . Thanks Kumar Vishal -- You received this message because you are subscribed to

[algogeeks] [amazon ] Finding Sub segment

2012-06-25 Thread Navin Kumar
please provide some good data structure to solve this problem: http://www.careercup.com/question?id=14062676 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] Find the Pair of X,Y [ 1/x + 1/y = 1/N! ]

2012-06-25 Thread prakash y
2! - x=y=4 3! - x=y=12 4! - x=y=48 5! - x=y=240 6! - x=y=1440 I don't have proof to prove x = y always. But if x=y, then the answer should be x=y=2*n! On Mon, Jun 25, 2012 at 5:04 PM, Roshan kumar...@gmail.com wrote: Few Months back I found the problem on Code Sprint 1/x + 1/y = 1/N! (N

Re: [algogeeks] Abridged summary of algogeeks@googlegroups.com - 10 Messages in 8 Topics

2012-06-25 Thread amit singh
sourabh singh, i think problem in your code may arise due to term (m/a -n/a) ,instead it should be m/a -(n-1)/a . there may be some other problem also .but this can be one of them On Mon, Jun 25, 2012 at 5:10 PM, algogeeks@googlegroups.com wrote:   Today's Topic Summary Group:

Re: [algogeeks] Find the Pair of X,Y [ 1/x + 1/y = 1/N! ]

2012-06-25 Thread Kishore
This is from interviewstreet named with equations On Mon, Jun 25, 2012 at 11:19 AM, prakash y yprakash@gmail.com wrote: 2! - x=y=4 3! - x=y=12 4! - x=y=48 5! - x=y=240 6! - x=y=1440 I don't have proof to prove x = y always. But if x=y, then the answer should be x=y=2*n! On Mon, Jun

[algogeeks] 1/x + 1/y = 1/(n factorial)

2012-06-25 Thread Kumar Vishal
We have to find number of Pair(x,y) which will satisfy the eq: 1/x + 1/y = 1/(n factorial) for large 0 N 10 ^ 4 N is integer Its problem from Code Sprint I tried to solve it by taking LOG but the sol was very slow , can any one please help Thanks Kumar Vishal -- You received this

Re: [algogeeks] Is max distance between two leaves(diameter) in a tree is equal to max distance between any two node in that tree??

2012-06-25 Thread Mohit Khanna
What would be the diameter in case of a left skewed or right skewed tree? On Mon, Jun 25, 2012 at 12:48 PM, atul anand atul.87fri...@gmail.comwrote: consider a case where tree is right skewed or left skewed , in dat case max distance b/w two node found are root and leftmost or rightmost

Re: [algogeeks] Find the Pair of X,Y [ 1/x + 1/y = 1/N! ]

2012-06-25 Thread Kumar Vishal
@Prakash The Pattern given by u is because factorial (n) is always *even *so u can always divide them in two equal part . what about 1/6= 1/8 + 1/24( 6 = factorial (3)) On Mon, Jun 25, 2012 at 11:24 PM, Kishore kkishoreya...@gmail.com wrote: This is from interviewstreet

Re: [algogeeks] Find the Pair of X,Y [ 1/x + 1/y = 1/N! ]

2012-06-25 Thread Kumar Vishal
Sorry My Mistake *Number of pairs should be OUTPUT...* On Mon, Jun 25, 2012 at 8:49 PM, prakash y yprakash@gmail.com wrote: 2! - x=y=4 3! - x=y=12 4! - x=y=48 5! - x=y=240 6! - x=y=1440 I don't have proof to prove x = y always. But if x=y, then the answer should be x=y=2*n! On

[algogeeks] Inorder Iterative code for printing paths

2012-06-25 Thread Nishant Pandey
thiss is iterative inorder code i am using for printing all the paths of the Btree . but i am not able to manipulate the lengths properly when its perform pop up so that i can print the paths properly .. Can any one help by modifying the changes in this code . void inorder(struct node *root)

Re: [algogeeks] [amazon ] Finding Sub segment

2012-06-25 Thread atul anand
http://www.leetcode.com/2010/11/finding-minimum-window-in-s-which.html On 6/25/12, Navin Kumar algorithm.i...@gmail.com wrote: please provide some good data structure to solve this problem: http://www.careercup.com/question?id=14062676 -- You received this message because you are

Re: [algogeeks] Find the Pair of X,Y [ 1/x + 1/y = 1/N! ]

2012-06-25 Thread prakash y
@Vishal, If the output should be the total no.of pairs, then i think there are infinite no.of such pairs. but not sure. Can someone provide me the link to the actual problem and some analysis of solution? Thanks, ~Prakash. On Mon, Jun 25, 2012 at 9:45 PM, Kumar Vishal kumar...@gmail.com wrote: