[algogeeks] Re: partitioning the array

2011-05-09 Thread anshu
@gaurav both things are same, matrix is a simple and efficient way to do problem like this. . -- 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,

Re: [algogeeks] Re: Candy_splitting in GCJ

2011-05-09 Thread Kunal Patil
OMG !!! Was it so easy I feel lyk crying that i didnt think of this...Really bad of mine.. [?][?] -- 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

Re: [algogeeks] Re: Extract Top K elements from a List of N elements based on frequency

2011-05-09 Thread Ashish Goel
Dave, w.r.t statement, After all integers are processed, compress out the unused hash table entries and find the Kth largest element, I could not understand the compress concept...are you saying something on counting sort philosophy? say the list is 5 4 4 3 3 3 2 2 2 2 1 1 1 1 1 so the hash

Re: [algogeeks] Re: partitioning the array

2011-05-09 Thread Gaurav Aggarwal
yes we would use 2 dimensional array to store the values inbetween but the main question here is that is the reccurence realation correct?? On Mon, May 9, 2011 at 11:31 AM, anshu anshumishra6...@gmail.com wrote: @gaurav both things are same, matrix is a simple and efficient way to do problem

Re: [algogeeks] Candy_splitting in GCJ

2011-05-09 Thread Abioy Sun
And the last one, GoroSort? 2011/5/9 kumar anurag anurag.it.jo...@gmail.com find xor of all elements - if its equal to zeo then Case has solution otherwise NO for finding the soltuion just sort all the elements and find the (sum of all -sum of smallest).. On Sun, May 8, 2011 at 9:50 PM,

Re: [algogeeks] Re: partitioning the array

2011-05-09 Thread anshu mishra
@gaurav f(i, j) = {(total number we need to make sum j including ith number in array), if its not possible than -1}; f(i, j) = f(i-1, j-ar[i]) + 1 -- if (i-1, j-ar[i]) != -1; answer will be the largest j for which f(i, j) will be exactly equals to n/2; there is something more in this but when

Re: [algogeeks] [brain teaser ] NUMBER SEQUENCE PUZZLE 9 may

2011-05-09 Thread Vandana Bachani
The answer is 3. Its a sequence of the number of digits in the word form of the index. one, two, three, four, five, six, seven 3, 3, 5, 4, 4, 3, 5 On Mon, May 9, 2011 at 12:52 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: NUMBER SEQUENCE PUZZLE ** * * ** *Fill in the blanks: 3 3 5 4 4

[algogeeks] Re: Extract Top K elements from a List of N elements based on frequency

2011-05-09 Thread Dave
@Ashish: By compress, I meant to transfer the active entries in the hash table into contiguous elements of an array. Since the hash table itself is probably stored in an array, it just means to go through the hash table array and move the active entries to the front of the array. Dave On May 9,

Re: [algogeeks] GOOGLE INTERVIEW QUESTION

2011-05-09 Thread hary rathor
bro no company will accept your program with goto statement . -- 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: Run for a google years

2011-05-09 Thread Don
That would do it if you have a 64-bit type, which most implementations have, but the standard does not require. I think that I can make it shorter and cleaner. int main(int argc, char* argv[]) { const int n=49; char a[n]={0}; int p=0; // This line will run for 10^100 years

[algogeeks] Re: Amazon Interview Question

2011-05-09 Thread bittu
see here let me know if anything wrong..?? http://shashank7s.blogspot.com/2011/05/wap-to-find-minimum-difference-between.html Thanks Regrads Shashank the Best Way to Escape From The problem is to Solve it Computer Science Engg. BIT Mesra -- You received this message because you are

Re: [algogeeks] Candy_splitting in GCJ

2011-05-09 Thread Rahul Singal
abhijith can you explain , how you got E(n) = N , Thanks in advance Rahul Singal -- 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

Re: [algogeeks] Candy_splitting in GCJ

2011-05-09 Thread abhijith reddy
Let *E(n)* be the *expected* number of hits needed sort *'n'* *misplaced*numbers. The optimal strategy is to hold the numbers that are already in place and shuffle the remaining. Now after a shuffle assume that x numbers are still out of place. Hence we get the following recurrence. E(n) = Sum[

[algogeeks] n wires puzzle plz help this ques is freaking me out

2011-05-09 Thread ArPiT BhAtNaGaR
You're an electrician working at a mountain. There are N wires running from one side of the mountain to the other. The problem is that the wires are not labeled, so you just see N wire ends on each side of the mountain. Your job is to match these ends (say, by labeling the two ends of each wire in

[algogeeks] Re: n wires puzzle plz help this ques is freaking me out

2011-05-09 Thread ArPiT BhAtNaGaR
got it @ last sorry to disturb u guys if any one want answer feel free to ask On Mon, May 9, 2011 at 10:41 PM, ArPiT BhAtNaGaR arpitbhatnagarm...@gmail.com wrote: You're an electrician working at a mountain. There are N wires running from one side of the mountain to the other. The problem is

Re: [algogeeks] Re: n wires puzzle plz help this ques is freaking me out

2011-05-09 Thread Anand
Could you please share your answer? On Mon, May 9, 2011 at 11:13 AM, ArPiT BhAtNaGaR arpitbhatnagarm...@gmail.com wrote: got it @ last sorry to disturb u guys if any one want answer feel free to ask On Mon, May 9, 2011 at 10:41 PM, ArPiT BhAtNaGaR arpitbhatnagarm...@gmail.com wrote:

Re: [algogeeks] [brain teaser ] NUMBER SEQUENCE PUZZLE 9 may

2011-05-09 Thread Vandana Bachani
Corrected. On Mon, May 9, 2011 at 5:57 PM, Vandana Bachani vandana@gmail.comwrote: The answer is 3. Its a sequence of the number of characters in the word form of the index. one, two, three, four, five, six, seven 3, 3, 5, 4, 4, 3, 5 On Mon, May 9, 2011 at 12:52 PM, Lavesh Rawat

[algogeeks] Last Call for Papers: The 2011 International Conference on Computer Graphics and Virtual Reality (CGVR'11), USA, July 18-21, 2011

2011-05-09 Thread A. M. G. Solo
Dear Colleagues: Please share the announcement below with those who might be interested. Thank you very much. Best regards, Organizing Committee     CALL FOR PAPERS - Deadline:  May 23, 2011      

[algogeeks] Re: n wires puzzle plz help this ques is freaking me out

2011-05-09 Thread Dave
@ArPiT: Here is one answer: Suppose that there are N wires. If N is even: At the first end, connect pairs of wires together, leaving two wires unconnected. Go to the other end. Find a pair of connected wires, and number them #2 and #3. Find another pair and label them #4 and #5. Repeat for all of

Re: [algogeeks] GOOGLE INTERVIEW QUESTION

2011-05-09 Thread Anders Ma
sometimes we need goto, goto is not so evil. On Tue, May 10, 2011 at 2:49 AM, Manjeet Chayel chayel.manj...@gmail.com wrote: Dont use goto... its not good to have it. On Mon, May 9, 2011 at 2:44 PM, Anders Ma xuejiao...@gmail.com wrote: #include stdio.h #include string.h int

Re: [algogeeks] GOOGLE INTERVIEW QUESTION

2011-05-09 Thread oldman
I agree with Anders Ma's point,but in my opinion, using goto is risky in a import interview On Tue, May 10, 2011 at 9:52 AM, Anders Ma xuejiao...@gmail.com wrote: sometimes we need goto, goto is not so evil. On Tue, May 10, 2011 at 2:49 AM, Manjeet Chayel chayel.manj...@gmail.com wrote:

Re: [algogeeks] GOOGLE INTERVIEW QUESTION

2011-05-09 Thread Anders Ma
#include stdio.h #include string.h int is_palindrome(char* string, int start, int end) { int i = start, j = end; while (start = end) { if (string[start++] != string[end--]) return 0; } /* print */ printf([%d,%d] ,