[algogeeks] Re: doubt in TSUM

2011-12-19 Thread SAMMM
I am giving the link I found useful :- http://www.cs.iastate.edu/~cs577/handouts/polymultiply.pdf There are many other good links , try to google it . -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algog

Re: [algogeeks] Re: doubt in TSUM

2011-12-19 Thread prathamesh sonpatki
@ALL is there any tutorial on FFT in C/C++ ? On Mon, Dec 19, 2011 at 5:27 PM, SAMMM wrote: > @Atul--- > > > Read the Comment carefully . > I told :- > > "For finding the triplet we need to have a equation of the form : > f(x) ^3 + af(x)^2 + b f(x) . need to to find the cofficient of a > and

[algogeeks] Re: doubt in TSUM

2011-12-19 Thread SAMMM
@Atul--- Read the Comment carefully . I told :- "For finding the triplet we need to have a equation of the form : f(x) ^3 + af(x)^2 + b f(x) . need to to find the cofficient of a and b where f(x) is the polynomial formed from the elements in the given set. This method will suffice the time

Re: [algogeeks] Re: doubt in TSUM

2011-12-19 Thread atul anand
@samm : for FFT method :- i dont find it working for sum of 3. i.e f(x) * f(x) *f(x) , its not giving rite output. On Sat, Dec 17, 2011 at 9:56 PM, SAMMM wrote: > @All , > > The problm can be solved by Fast Fourier Transform . > The Concept used here is to Convert the number in the array into

Re: [algogeeks] Re: doubt in TSUM

2011-12-18 Thread SAMM
@ All, The multiplication of the polynomial need to be done using FFT becoz it will take O(nlog n) where n is the number of elements in the set. For finding the triplet we need to have a equation of the form : f(x) ^3 + af(x)^2 + b f(x) . U need to to find the cofficient of a and b where f(x)

Re: [algogeeks] Re: doubt in TSUM

2011-12-18 Thread SAMM
This comment was for anubhav code which he wrote :--- U will not get correct solution with this algo becoz ur algo will not able to generate all the 3 triplets sum. You hav to loop through all the triplets ... take for example the numbers :- 1 2 3 5 6.. Ur algo will generate the following t

Re: [algogeeks] Re: doubt in TSUM

2011-12-18 Thread anubhav raj
@shamm:it means if we want for triplet do we nd 2 go for 3 time multiplication of polynomial and den division of coefficient by 3.. -- 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.co

Re: [algogeeks] Re: doubt in TSUM

2011-12-18 Thread Karthikeyan V.B
Hi, Actually i m sorry since i didn explain the algo fully i checked with the code the o/p is: run: 6:1 7:0 8:1 9:2 10:2 11:1 12:1 13:1 14:1 where sum 9 has two triplets so,totally (1+0+1+2+2+1+1+1+1=10) Regards, KARTHIKEYAN.V.B PSG TECH CBE -- You received this message because you are s

Re: [algogeeks] Re: doubt in TSUM

2011-12-17 Thread prathamesh sonpatki
@SAMMM Hi Nice Solution.How did u relate it to FFT ? On Sat, Dec 17, 2011 at 9:56 PM, SAMMM wrote: > @All , > > The problm can be solved by Fast Fourier Transform . > The Concept used here is to Convert the number in the array into a > vector and Then apply multiplication using FFT . The below e

[algogeeks] Re: doubt in TSUM

2011-12-17 Thread SAMMM
@All , The problm can be solved by Fast Fourier Transform . The Concept used here is to Convert the number in the array into a vector and Then apply multiplication using FFT . The below example will clear it . I will start will finding Pair of all Number equal to every possible combination from

[algogeeks] Re: doubt in TSUM

2011-12-17 Thread SAMMM
You will not be able to get the correct solution with this algo becoz ur algo will not able to generate all the 3 triplets sum. You hav to loop through all the triplets ... take for example the numbers :- 1 2 3 5 6.. Ur algo will generate the following triplet sum as 9 10 12 8 6 11 13 10 14 ..

Re: [algogeeks] Re: doubt in TSUM

2011-12-17 Thread Karthikeyan V.B
Hi, *TSUM:* This is also a brute-force approach.. Pls correct me if i m wrong Algorithm: 1.sort the array 2.find the sum of the three min elements -> sum_min 3.find the sum of the three max elements -> sum_max 4.for each value in [sum_min,sum_max] binary search for the triplet in

Re: [algogeeks] Re: doubt in TSUM

2011-12-16 Thread anubhav raj
hey dude jst paste the link of ways(paths-120 bytes) you told its on google but i cudnt find it.tnx -- 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 t

Re: [algogeeks] Re: doubt in TSUM

2011-12-16 Thread anubhav raj
@samm:you are checking for each sum between min sum and max sum & in each loop we are skipping several triplets(sum) which hai intermediate sum..this is also a o(n^3) brute-force almost...i have written a code jst c it .can u think in this direction so dat we wl b able t

Re: [algogeeks] Re: doubt in TSUM

2011-12-16 Thread anubhav raj
@samm:tnx dude lemme first chk it...den i wl b able 2 discuss it further. -- 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] Re: doubt in TSUM

2011-12-16 Thread SAMMM
Heey dude !! He has given the link tht show the way how to find the sum from a distinct , you need to manipulate the algorithm . Below is the modified code . #include #include #include using namespace std; int N[40001]={0}; int compare(const void *a,const void *b) { return( (*(int*)a)-(*(int*)b

Re: [algogeeks] Re: doubt in TSUM

2011-12-15 Thread anubhav raj
shashank.dude the algorithm whch u suggested in the morning for tsum ...hv u tried it wid urself bcoz wid the wiki link method if we wl sort the array den wat b the delimiter so that ,i wl get get all combination of 3 .in dat method dat wz given for sum of three numb

Re: [algogeeks] Re: doubt in TSUM

2011-12-15 Thread anubhav raj
hey ,dude tnx for your reply yesterday i googled it bt cudnt get ..newy tnx dude -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@

Re: [algogeeks] Re: doubt in TSUM

2011-12-15 Thread WgpShashank
@anubhaw ..its like spoon feeding , never mind u could have googled it :D http://www.google.co.in/search?q=3+sum&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a Thanks Shashank Mani CSE, BIT Mesra http://shashank7s.blogspot.com/ -- You received this message because you a

Re: [algogeeks] Re: doubt in TSUM

2011-12-14 Thread anubhav raj
HEY DUDE TNX FOR THE REPLY .CAN YOU PASTE ME THE LINK FOR THAT WIKI PAGE. -- 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 e

[algogeeks] Re: doubt in TSUM

2011-12-14 Thread WgpShashank
@anubhaw ..check wiki for O(N^2) algorithm ..u will get the logic Thanks Shashank Mani CSE , BIT Mesra http://shashank7s.blogspot.com/ -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups