[algogeeks] [Off-topic]If you have any issues about membership, read about google groups dont mail moderators and owners

2012-01-04 Thread shady
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at ht

[algogeeks] Re: Longest sequence of numbers with atmost diff K

2012-01-04 Thread Lucifer
@atul... As usual an editing mistake :) int X[2][N] -> int X[2][N+1]; - Regarding the new fixed code's explanation: Basically as explained by praveen.. There are 2 things that need to be done to solve the problem: 1) Pick 2 nos and see if their abs diff is > K or n

[algogeeks] Re: Longest sequence of numbers with atmost diff K

2012-01-04 Thread Lucifer
@atul.. First of all 6 is not in the heap but its index '0' is.. I think before also u had raised this question of heap stability and i did explain with an example in one of my previous posts that it won't affect the checks... I m repeating the same explanation here with the reason why it won't a

[algogeeks] Re: Longest sequence of numbers with atmost diff K

2012-01-04 Thread gaurav bansal
@all sorry for my prev post. On Jan 5, 12:42 am, gaurav bansal wrote: > your algo wont work for  a[]={8,11,2} with k=7. > acc to u,ans should be 3,but it is 2. > you are not considering the diff between max and min value -- You received this message because you are subscribed to the Google Grou

[algogeeks] Re: Longest sequence of numbers with atmost diff K

2012-01-04 Thread gaurav bansal
your algo wont work for a[]={8,11,2} with k=7. acc to u,ans should be 3,but it is 2. you are not considering the diff between max and min value -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@go

Re: [algogeeks] Re: check Similar array

2012-01-04 Thread atul anand
@Ankur : i guess this would work but to your test add one more sizeof(arr); On Wed, Jan 4, 2012 at 10:00 PM, Ankur Garg wrote: > sorry it shud be > sum of squares and xor and sumof elements > > I think this shud work > > Regards > Ankur > > > > > On Wed, Jan 4, 2012 at 9:52 PM, atul anand wrote:

Re: [algogeeks] Re: check Similar array

2012-01-04 Thread Ankur Garg
sorry it shud be sum of squares and xor and sumof elements I think this shud work Regards Ankur On Wed, Jan 4, 2012 at 9:52 PM, atul anand wrote: > @ Karthikeyan : > > sum of cubes fails:- > > arr1={2,3,0,-3} = 4 > arr2={1,1,1,1} = 4 > > On Wed, Jan 4, 2012 at 6:53 PM, Karthikeyan V.B wro

Re: [algogeeks] Re: check Similar array

2012-01-04 Thread atul anand
@ Karthikeyan : sum of cubes fails:- arr1={2,3,0,-3} = 4 arr2={1,1,1,1} = 4 On Wed, Jan 4, 2012 at 6:53 PM, Karthikeyan V.B wrote: > Hi, > > Consider, arr1={1,2,3} and arr2={-1,-2,-3} > > using sum of squares method sum(arr1) = 14 ans sum(arr2) = 14 (since > square of 1 and -1 is 1) > > so

Re: [algogeeks] Re: check Similar array

2012-01-04 Thread atul anand
@ankur : arr1={0,2,0,2); arr2={1,1,1,1}; xor ans sum condition satisfy. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeek

Re: [algogeeks] Re: check Similar array

2012-01-04 Thread Ankur Garg
What if we check these 2 conditions XOR and sum of elements and sizeof array same I cudnt find any counter example Regards Ankur On Wed, Jan 4, 2012 at 6:53 PM, Karthikeyan V.B wrote: > Hi, > > Consider, arr1={1,2,3} and arr2={-1,-2,-3} > > using sum of squares method sum(arr1) = 14 ans sum

Re: [algogeeks] Re: check Similar array

2012-01-04 Thread Karthikeyan V.B
Hi, Consider, arr1={1,2,3} and arr2={-1,-2,-3} using sum of squares method sum(arr1) = 14 ans sum(arr2) = 14 (since square of 1 and -1 is 1) so it won work with this case 1.better take the square and negate it before adding or 2.take sum of cubes pls correct me if i'm wrong Regards, Karthike

Re: [algogeeks] Amazon Onsite

2012-01-04 Thread gaurav arora
Sorry there is some correction p[] : array of petrol d[]: array of distance int FirstPetrolPump(int p[],int d[],int n) { int c=0,ThisPetrol=0,FirstPump=0,i; for(i=0;ihttp://groups.google.com/group/algogeeks?hl=en.

[algogeeks] Playing with memory

2012-01-04 Thread Vanathi Algogeeks
*Playing with memory* * * Sindhu and Alistair play a memory game involving of a sequence of random numbers between *1 *and *10*, inclusive, that is called out one at a time. Each player can remember up to *5 *previous numbers. When the called number is in a player's memory, that player is aw

[algogeeks] Re: check Similar array

2012-01-04 Thread shiv narayan
can't be use squares of no's as said by rahul patil as said in previous comment?? On Jan 4, 10:57 am, atul anand wrote: > @sharad : after checking the link provided by u...it seem like complexity > will be O(n^2) { not sure } + saurabh point is also valid. -- You received this message because y

Re: [algogeeks] Re: String passing

2012-01-04 Thread rahul patil
When u say char p[]="hello"; memory to array is allocated on stack and "hello" is written into that array. so u can modify "hello" by saying p[0]= 'y'; = when u say char *x="hello"; memory to x is allocated on stack, but string "hello" is plac

Re: [algogeeks] Re: Modular arithmetic + Combinatorics

2012-01-04 Thread atul anand
@Dave : in your pseudo code for B(m,n) you are not using m ... i guess there is a typo error. this should be num[i]=m + 1 -i instead of this num[i] = n + 1 - i -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send emai