Re: [algogeeks] find point lies in side circle

2012-01-07 Thread shady
@sravanreddy i dont think that will work, On Fri, Jan 6, 2012 at 9:01 PM, sravanreddy001 sravanreddy...@gmail.comwrote: @dabbcomputers: looking at the worstcase, listing all points in the set itself takes O(n) time, just to speed up the time would be sort all the points(x,y) wrt x-values

Re: [algogeeks] Re: finding all combination

2012-01-07 Thread Adolfo Ccanto
this problem is solved in O(n*s), where n is the size of Array and s is the sum, the aproach is Dynamic Programming. 2012/1/6 saurabh singh saurab...@gmail.com @all Yes it is possible to find the solution using 0/1 knapsack.The approach would be similar as in case of LCS problem when many

Re: [algogeeks] Re: finding all combination

2012-01-07 Thread atul anand
@ Adolfo : little more detail about your approach will be helpful. On Sat, Jan 7, 2012 at 7:07 PM, Adolfo Ccanto adol...@gmail.com wrote: this problem is solved in O(n*s), where n is the size of Array and s is the sum, the aproach is Dynamic Programming. 2012/1/6 saurabh singh

[algogeeks] Re: finding all combination

2012-01-07 Thread Lucifer
@all Check the link that i have provided above.. It solves the problem using DP.. On Jan 7, 7:15 pm, atul anand atul.87fri...@gmail.com wrote: @ Adolfo  : little more detail about your approach will be helpful. On Sat, Jan 7, 2012 at 7:07 PM, Adolfo Ccanto adol...@gmail.com wrote: this

[algogeeks] Re: SuperSum

2012-01-07 Thread Lucifer
@Anurag... 'SuperSum' can be reduced to the following form.. SuperSum ( k, n) = SuperSum (k-1, n) * (n+k) / (k+1) .. Time Complexity : O(K) , Space Complexity : O(1) Code: int getSuperSum(int k, int n) { int superSum = n; // SuperSum(0, n) int i = 0; while( ++i = k) {

[algogeeks] Re: Maximal possible subsets Algorithm

2012-01-07 Thread atul007
@Lucifier: i guess you made some editing mistake :- Initialize the array with the following values, 1) A[0, j] = 0 for 1 = j = Wmax 2) A[i, 0] = 1 for 0 = i = Wmax // it shoud be 1 for 0 = i =N about this equation :- A[i , j] = A[i-1, j] | A[ i-1 , j - W[i] ] say if W[i]=10 and j=3 , i

Re: [algogeeks] Re: finding all combination

2012-01-07 Thread atul anand
@Don : what would be the complexity of your alogithm?? On Sat, Jan 7, 2012 at 2:01 AM, Don dondod...@gmail.com wrote: Given an array A[n], start by sorting the array. Then do something like this: int result[n]; int size=0; void findSubset(int sum, int position=0) { if (sum == 0)

[algogeeks] Re: Maximal possible subsets Algorithm

2012-01-07 Thread Lucifer
@atul.. I thought that check would be obvious as i didn't put in the code.. so when the code is written for the second option we need to also check for j-W[i] =0.. :)... On Jan 7, 9:15 pm, atul007 atul.87fri...@gmail.com wrote: @Lucifier: i guess you made some editing mistake :- Initialize

[algogeeks] Re: finding all combination

2012-01-07 Thread Lucifer
@atul.. So following the above previous posted link.. the time complexity would be 4*n = O(n)... [ just adding it here, because i saw that u went thru the link.. :)] On Jan 7, 9:30 pm, atul anand atul.87fri...@gmail.com wrote: @Don : what would be the complexity of your alogithm?? On

Re: [algogeeks] Re: Maximal possible subsets Algorithm

2012-01-07 Thread atul anand
@Lucifer : thats okbut you are using bitwise OR to fill up the array A[]. if condition does not fullfill then wat to do to fill A[i,j] ?? i guess take it 0 if it does not fullfill.. A[i , j] = A[i-1, j] | 0 // A[ i-1 , j - W[i] ] check fail i didnt read your whole algorithm so i

Re: [algogeeks] Re: finding all combination

2012-01-07 Thread atul anand
To remove duplicate combination in DON code...here is the modified code:- Given an array A[n], start by sorting the array. Then do something like this: int result[n]; int size=0; int prev=-1; // added void findSubset(int sum, int position=0) { if (sum == 0) output(result, size); for(int i

[algogeeks] Re: find point lies in side circle

2012-01-07 Thread Gene
If the graph is planar and you have it's embedding, then you can do better than O(N), at least on a random graph. Otherwise this has to be impossible because the graph gives you no information, and you must look at each vertex. On Jan 5, 1:17 pm, dabbcomputers dabbcomput...@gmail.com wrote: you

Re: [algogeeks] Re: Maximal possible subsets Algorithm

2012-01-07 Thread atul anand
@Lucifer : for W[]={1,3,2,1,2} and Wmax=4. this array will be formed. 0 1 2 3 4 0 1 0 0 0 0 1 1 1 0 0 0 3 1 1 0 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 is it printing all subset ?? if yes then may be i am not getting it.. btw one query :- b) if

[algogeeks] Re: find point lies in side circle

2012-01-07 Thread Dan
On Jan 5, 4:17 am, dabbcomputers dabbcomput...@gmail.com wrote: you are given with N points on graph. and a point A on graph and range R you have to find the points that lies within the radius of R from point A. with complexity less than O(N). Why does it have to be done with less complexity

[algogeeks] Re: find point lies in side circle

2012-01-07 Thread sravanreddy001
@Gene: I didn't understand on what you termed as embedding Can you provide more insights on this? @dabbcomputers: also, listing set of points (not just one) isn't going to be a better than O(n) solution. for eg: a value of R that eliminates only half the points outside the circle. -- You

[algogeeks] Re: find point lies in side circle

2012-01-07 Thread Gene
An embedding is the information that says how the graph is laid out with no edges crossing. As a data structure, it can be given in various ways. The simplest is for adjacency lists of each vertex to be given in sorted order clockwise or anti-clockwise. On Jan 7, 5:10 pm, sravanreddy001

Re: [algogeeks] suggest algo

2012-01-07 Thread sravanreddy001
@shashank: sorting the hashed values is more intensive than using the heap with size K. (as kN) sorting hash -- N log N using heap -- N log k also, i just read about the splay trees.. this can improve the performance of 'N log N factor' right when used on input, though it can be used on a

[algogeeks] Re: check Similar array

2012-01-07 Thread sravanreddy001
@shashank: your approach fails for (2,0,0,0) (1,1,1,1) but.. from any of the above approaches seen, we couldn't be 100% sure of the solution, but, from shashank's approach, the probability of finding correct soultion can be improved by using some random prime numbers. (running tests for more

[algogeeks] Re: Playing with memory

2012-01-07 Thread sravanreddy001
Since A uses the MFU (most frequently used) to remove from memory, the number used twice will not be in memory and never called for. Mostly likely that A will win. (cannot say this 100% sure, though i don't see a situation where S wins) initial guess will be when any 5 numbers are repeated

Re: [algogeeks] Re: Maximal possible subsets Algorithm

2012-01-07 Thread sravanreddy001
any comments of the following approach. first sort the weights, find the 'j' such that sum( wts from w1 until wj) Wmax sum( wts from W1 until Wj+1) Wmax also 'k' such that sum(wts from Wk to Wn) Wmax sum(wts from Wk-1 to Wn) Wmax so, a = j ( is the max number of elements in any subset,)

Re: [algogeeks] Re: finding all combination

2012-01-07 Thread saurabh singh
Sorry for being offtopic but yes if anyone proposes a polynomial time algorithm(which can work for all cases) he is entitled to a prize money of 1 million. http://en.wikipedia.org/wiki/Millennium_Prize_Problems Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com

[algogeeks] Re: Maximal possible subsets Algorithm

2012-01-07 Thread Lucifer
@atul.. The table is used to record the state of subsets not print them.. (I am assuming that's what u meant)..Hence keeping that in mind, yes it captures all subsets... Now once A[N, K] is 1 that means there are some subsets whose sum will be equal to K. Hence, to find all such subsets we will

[algogeeks] extracting vector (digitization) from an ECG image

2012-01-07 Thread Deepak Garg
my question is about how to achieve digitization of an image/graph image. for example i have the following ECG image( taken from a normal camera ):- http://i.stack.imgur.com/QAMfk.png so what algorithm should i follow to get the digitized image, my final aim is to feed this information to a

[algogeeks] Heaviest Increasing Subsequence:Suggest Algo

2012-01-07 Thread kumar rajat
Hi Can any1 suggest a algo for heaviest increasing subsequence of a given array? (HIS is the LIS when weights are included for each element in the array) Thanks in advance -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,