Re: [algogeeks] max sum b/w 2 leaf nodes in a binary tree

2012-08-27 Thread Dave
@Ravi: That is also my understanding, so the solution involves traversing the tree and keeping track of the values of the two largest leaf nodes. Dave On Monday, August 27, 2012 12:53:05 PM UTC-5, Ravi Maggon wrote: > @atul > I think he is asking for max. sum of elements between 2 leaf nodes a

Re: [algogeeks] Re: Question on checking divisibility of binomial coefficients of a number by a prime number

2012-08-27 Thread Dave
@Ankit: I haven't written code for this problem, but here is how I would do it. You are given values of n and P, with n being up to a 500-digit number (e.g., stored in an array, with say 9 digits of the number stored in each of up to 112 (500/9 rounded up) integers and P fitting in one integer.

Re: [algogeeks] Duplicate file in all computers in a network

2012-08-27 Thread Ravi Maggon
This problem is similar to one to all broadcast in parallel computing. Imagine all the nodes in form of hypercube. On Wed, Aug 22, 2012 at 2:04 PM, Karthikeyan V.B wrote: > A network of N computers is such that each computer is connected to > every other.Transferring one byte of information betw

Re: [algogeeks] Suggest algo...

2012-08-27 Thread Ravi Maggon
keep a hash to check if digit is already used for that combination or not. add this logic to existing combinations generator code. On Sat, Aug 25, 2012 at 12:34 AM, amrit harry wrote: > find the all possible combination of digits ranging 1 to 9 whose sum is > 10, > no digit shud be repeated in a

Re: [algogeeks] max sum b/w 2 leaf nodes in a binary tree

2012-08-27 Thread Ravi Maggon
@atul I think he is asking for max. sum of elements between 2 leaf nodes and not the max distance between two nodes. On Sun, Aug 26, 2012 at 6:12 PM, atul anand wrote: > its the diameter of tree. > you can find implementation on geeksforgeeks > > On 8/25/12, kunal rustgi wrote: > > Hi, > > > >

Re: [algogeeks] Re: Question on checking divisibility of binomial coefficients of a number by a prime number

2012-08-27 Thread Ankit Singh
@dave: Can u Please elaborate your idea?? I didn't understand lucas theorem and in that theorem, i see too much calculation and here we have to deal with testcases upto 100 and each testcase containing n in range of 10500. On Mon, Aug 27, 2012 at 4:02 AM, Dave wrote: > @Ankit: Apply Lucas' The