[algogeeks] [brain teaser ] Greater than God Riddle 18 may

2011-05-18 Thread Lavesh Rawat
Greater than God Riddle 18 MAY PUZZLE *What is Greater than God, worse than evil, the poor have it, the rich require it, and if you eat it, you die?* * * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/05/greater-than-god-riddle-18-may.html?lavesh=lavesh

Re: [algogeeks] [brain teaser ] Greater than God Riddle 18 may

2011-05-18 Thread Piyush Sinha
*NOTHING*. *Greater than GOD - NOTHING* *Worse than EVIL - NOTHING* *Poor have it and rich want it - NOTHING* *if you eat it, you die - NOTHING * On Wed, May 18, 2011 at 12:35 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: Greater than God Riddle 18 MAY PUZZLE *What is Greater than God,

Re: [algogeeks] Array problem

2011-05-18 Thread amit kumar
@kunal patil your soln does not work for 5 3 4 5 3 3 On Tue, May 17, 2011 at 9:57 PM, Kunal Patil kp101...@gmail.com wrote: Ohh..If it is so...Sorry !![?] I understood it the different way...[?] But if the question is as mentioned in your 2nd case then also I believe there is O(n)

Re: [algogeeks] Array problem

2011-05-18 Thread amit kumar
i dnt htink a o(n) soln exists for this problem. On Wed, May 18, 2011 at 3:47 PM, amit kumar amitthecoo...@gmail.com wrote: @kunal patil your soln does not work for 5 3 4 5 3 3 On Tue, May 17, 2011 at 9:57 PM, Kunal Patil kp101...@gmail.com wrote: Ohh..If it is so...Sorry !![?] I

Re: [algogeeks] Array problem

2011-05-18 Thread Kunal Patil
@Amit: Ohh..Your test case is correct but not my solution..[?] It only works if it is guaranteed that one end will be at the extreme of the array ! (UseLess ! [?]) Sorry folks... So can anybody prove that O(n) solution does not exist for this problem? [?] -- You received this message because you

Re: [algogeeks] [brain teaser ] Greater than God Riddle 18 may

2011-05-18 Thread Kunal Patil
Hahaha...Nice answer Piyush ! On Wed, May 18, 2011 at 12:44 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: *NOTHING*. *Greater than GOD - NOTHING* *Worse than EVIL - NOTHING* *Poor have it and rich want it - NOTHING* *if you eat it, you die - NOTHING * On Wed, May 18, 2011 at 12:35

Re: [algogeeks] [brain teaser ] Greater than God Riddle 18 may

2011-05-18 Thread Bhavesh agrawal
nice answer... -- 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

Re: [algogeeks] Array problem

2011-05-18 Thread Piyush Sinha
I think it can be done in O(n) but the auxilliary space required will be more... in the solution which i have got its in the order of 2n On Wed, May 18, 2011 at 4:44 PM, Kunal Patil kp101...@gmail.com wrote: @Amit: Ohh..Your test case is correct but not my solution..[?] It only works if it is

Re: [algogeeks] Re: Google Q

2011-05-18 Thread saurabh agrawal
Dave, u said: a max-heap of the smallest half of the elements but if the number are randomply generated, then how will you get to know whether a number belongs to smallest half OR lager half.. i didnt got it... On Sat, May 14, 2011 at 9:10 PM, Dave dave_and_da...@juno.com wrote: @Ashish:

[algogeeks] Re: Google Q

2011-05-18 Thread Dave
@Saurabh: You look at the top elements in the two heaps. If the new number is between the values of the top of the heaps, you add it to the shorter of the two heaps, or to either heap if they are of equal length. If the new number is larger than the min of the min-heap, you add it to the min-heap.

[algogeeks] Re: how to find a smallest prime bigger than a given number

2011-05-18 Thread Don
Yes. Use a sieve. Don On May 17, 11:36 pm, wujin chen wujinchen...@gmail.com wrote: @Daveļ¼Œ thanks for your reply. i know that, i can only check from 6*n - 1 and 6*n + 1.. assume that, n=1 , and we begin from k=1667, the number needed to check is 10001,10003 but to determin 10001 is

Re: [algogeeks] Array problem

2011-05-18 Thread Piyush Sinha
last night i was going through a similar kind of question and tried to implement its algo in this question...If anyone finds any counter example for it, please do comment.. Algo:- *Let the array be A[]. We can keep two arrays B[] and C[] which will do the following work.. B[i] will store the