[algogeeks] Re: k nearest points

2010-12-06 Thread alexsolo
look here: http://en.wikipedia.org/wiki/Kd-tree -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] Re: FINDSR in spoj

2010-12-06 Thread alexsolo
http://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Re: Amazon Interview Question

2010-12-06 Thread Nikhil Agarwal
@Divesh I have updated my algo and Array A[1,2,3.n] is sorted with unique elements.CALL FIND_EQUAL(A,1,n) int FIND_EQUAL(A,start,end) 1.Go to the middle element 2. If A[mid]mid) 3. if(start==mid) 4 return mid-1; 5return FIND_EQUAL(A,1,mid-1); 6 if(A[mid]=mid) 7

Re: [algogeeks] convert binary matrix to zero matrix

2010-12-06 Thread Amir hossein Shahriari
actually a greedy approach for this problem exists: just convert the first row and first column to all zeros if after this step matrix is not a complete zero matrix then it's impossible to make it On Sun, Dec 5, 2010 at 9:10 AM, Prims topcode...@gmail.com wrote: How do i convert a binary

[algogeeks] Re: convert binary matrix to zero matrix

2010-12-06 Thread Prims
Amir Could you please explain with an example in detail? On Dec 6, 7:02 pm, Amir hossein Shahriari amir.hossein.shahri...@gmail.com wrote: actually a greedy approach for this problem exists: just convert the first row and first column to all zeros if after this step matrix is not a complete

[algogeeks] Re: Amazon Interview Question

2010-12-06 Thread Gene
You guys are working too hard. Think about the sequence of numbers [ A[i] - i | i = 0,1,2,...n-1 ]. You are trying to probe this sequence to find the number of zeros. If you think about it for a while, you will see that this sequence is non-decreasing. It must be a segment of zero or more

[algogeeks] Re: Amazon Interview Question

2010-12-06 Thread Gene
I should have mentioned that this problem only makes sense if the array values must be unique. On Dec 6, 8:20 pm, Gene gene.ress...@gmail.com wrote: You guys are working too hard.  Think about the sequence of numbers [ A[i] - i | i = 0,1,2,...n-1 ].  You are trying to probe this sequence to

Re: [algogeeks] Re: FINDSR in spoj

2010-12-06 Thread bharath kannan
I tried solving that prob..here's my code #includeiostream #includestring using namespace std; main() { string s; cins; while(1) { if(s.size()==1 s[0]=='*') break; int length=1,curr=0,start=0,count=1; for(int i=1;is.size();i++) { if(s[i]!=s[curr]

[algogeeks] Re: Microsoft interview question

2010-12-06 Thread ritesh
q = (len 1) 1; what this line is accomplishing? On Dec 4, 12:38 pm, Abioy Sun abioy@gmail.com wrote: Hello, 2010/12/4 siva viknesh sivavikne...@gmail.com:  Modified 2 color sort problem i.e. you are given an array of integers containing only 0s and 1s.You have to place all the 0s