[algogeeks] Re: random number generator

2011-03-18 Thread Gene
On Friday, March 18, 2011 1:47:45 PM UTC-4, Gene wrote: > > On Mar 17, 10:24 am, saurabh agrawal wrote: > > Given a function which returns true 60% time and false 40% time. > > > > Using this function you have to write a function which returns true 50% > of > > the time. > > If we call the

[algogeeks] Re: Robot Moving on The Maze..Need All possible Path

2011-03-18 Thread Karans
@Bittu haha... just copied the first answer from CCbook. On Mar 3, 10:42 am, bittu wrote: > both DP & Catalan Number solve this > > 1st Approach Catalan Number > > (For clarity, we will solve this part assuming an X*Y Matrix) > Each path has (X-1)+(Y-1) steps. Imagine the following paths: > > X X

Re: [algogeeks] [brain teaser ] 18march

2011-03-18 Thread gmagog...@gmail.com
"and" Yanan Cao On Fri, Mar 18, 2011 at 1:00 PM, anuj maurice wrote: > agree > > > On Fri, Mar 18, 2011 at 10:05 PM, Kunal Patil wrote: > >> Nothing !!! :P :P >> >> On Fri, Mar 18, 2011 at 1:02 PM, Lavesh Rawat wrote: >> >>> *A Riddle Problem Solution* >>> * >>> *What is one thing that all

Re: [algogeeks] [brain teaser ] 18march

2011-03-18 Thread anuj maurice
agree On Fri, Mar 18, 2011 at 10:05 PM, Kunal Patil wrote: > Nothing !!! :P :P > > On Fri, Mar 18, 2011 at 1:02 PM, Lavesh Rawat wrote: > >> *A Riddle Problem Solution* >> * >> *What is one thing that all wise men, regardless of their religion or >> politics, agree is between heaven and earth

Re: [algogeeks] [brain teaser ] 15march

2011-03-18 Thread Kunal Patil
@ ashu:---Very interesting and nice solution... On Tue, Mar 15, 2011 at 2:58 PM, Terence wrote: > To the east shop :) > One can not get his haircut by himself. > > > On 2011-3-15 15:55, Lavesh Rawat wrote: > > > * barbershop **Problem Solution* > * > *A traveller arrives in a small town and dec

Re: [algogeeks] SPOJ problem-BRCKTS

2011-03-18 Thread Kunal Patil
Hey.. I also got into same trouble today... I submitted it 6 times..then got bored and de moralised cause i cudnt find flaw in code... When i read your mail and corresponding sorry mail...it just struck me..I also had to print "YES" and "NO"and i was printing "NO" as "No"It got ac den... :P

Re: [algogeeks] Need help regarding the SPOJ problem...

2011-03-18 Thread Balaji Ramani
Hi, I hope this is correct. Please correct if I am wrong. Short answer: Let a = (k-n)/(n-1) Let b = (k-n)%(n-1) steps = (n-1)(a)(a+1)/2 + b Put = steps + n Remove = steps Explanation: Example with n = 3 & k =10: Start by putting balls in 1,2,3 1 2 3 x x x x x x Now move balls from 1-3 to 3

[algogeeks] Re: random number generator

2011-03-18 Thread Gene
On Mar 17, 10:24 am, saurabh agrawal wrote: > Given a  function which returns true 60% time and false 40% time. > > Using this function you have to write a function which returns true 50% of > the time. If we call the function N times, then the probability that we'll have K true values returned i

[algogeeks] Re: A Billion Number Question

2011-03-18 Thread Dave
Assuming the data is 32-bit unsigned integers: Treat your memory (either amount) as an array A[] of M integers. E.g., with 10 MB of memory, M = 2,500,000. Initialize the array to zero. Read through the file. For each integer x, increment A[x mod M]. There will be at least one bin whose count is no

Re: [algogeeks] SPOJ Problem : PRIME1

2011-03-18 Thread Anurag atri
you should try sieve of eratosthenes http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes there are far more efficient algorithms but i think this shoild be a good one to start with . ( even i got AC with this one :) ) On Fri, Mar 18, 2011 at 10:11 PM, samby wrote: > The problem goes like this :

[algogeeks] SPOJ Problem : PRIME1

2011-03-18 Thread samby
The problem goes like this : Peter wants to generate some prime numbers. Your task is to generate all prime numbers between two given numbers! Input The input begins with the number t of test cases in a single line (t<=10). In each of the next t lines there are two numbers m and n (1 <= m <= n <=

Re: [algogeeks] [brain teaser ] 18march

2011-03-18 Thread Kunal Patil
Nothing !!! :P :P On Fri, Mar 18, 2011 at 1:02 PM, Lavesh Rawat wrote: > *A Riddle Problem Solution* > * > *What is one thing that all wise men, regardless of their religion or > politics, agree is between heaven and earth > > Update Your Answers at : Click > Here

Re: [algogeeks] Re: 10 digit problem

2011-03-18 Thread Kunal Patil
@Gunjan Sharma: Why do you think 50 is not an acceptable answer??? You might be thinking last 5 zeroes not representing the number of zeroes followed..thus you gave an answer as 10 in one of your previous post... But as per the problem is exemplified, *if it is the original precise

Re: [algogeeks] Re: 10 digit problem

2011-03-18 Thread Ashish Goel
10 is the best answer if the condition is number of non-zero digits should be maximum... Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Wed, Mar 16, 2011 at 8:08 PM, Gunjan Sharma wrote: > 10 what about this?? > > -- > You rece

Re: [algogeeks] A Billion Number Question

2011-03-18 Thread ankit sambyal
Assuming each integer takes 4 bytes, for 4 billion numbers it turns out to be 16 GB memory required. But we have only 1 GB memory. 1. So, break the 16GB file into 16 1GB files. 2. Then one by one take each file into memory and run quick sort algorithm on it and put it back in the same file. After

[algogeeks] Re: Brainfuck compiler

2011-03-18 Thread cegprakash
@saikat: this place is only to share the algorithms and not the codes -- 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+un

[algogeeks] Re: Brainfuck compiler

2011-03-18 Thread cegprakash
thank you so much kumar anurag. will try it out and reply soon. On Mar 16, 1:24 am, kumar anurag wrote: > the code is attached , u can covert bf program to c , more info is in the > file > > On Wed, Mar 16, 2011 at 12:43 AM, Saikat Debnath wrote: > > > > > @ kumar anurag : Can you please upload t

[algogeeks] Need help regarding the SPOJ problem...

2011-03-18 Thread shubham
You have N marbles and K slots. You have to follow the below mentioned rules : 1. You can put in a marble or take out a marble from slot numbered 1 at any time. 2. You can put in a marble or take out a marble from slot numbered i only if there exists a marble at the slot i - 1. 3. The gam

Re: [algogeeks] nzec

2011-03-18 Thread DIPANKAR DUTTA
http://discuss.codechef.com/showthread.php?t=635 On Thu, Mar 17, 2011 at 7:11 PM, kavitha nk wrote: > > oh 5n.. > > > >> >> >> >> >> -- >> //BE COOL// kavi >> > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, s

Re: [algogeeks] Application N-ary Tree..Important Question As Well

2011-03-18 Thread DIPANKAR DUTTA
this is something like Multiple granularity locking protocol in DBMS... On Fri, Mar 18, 2011 at 5:43 PM, bittu wrote: > Given an n-ary tree of resources arranged hierarchically. A process > needs to lock a resource node in order to use it. But a node cannot be > locked if any of its descendant

[algogeeks] Application N-ary Tree..Important Question As Well

2011-03-18 Thread bittu
Given an n-ary tree of resources arranged hierarchically. A process needs to lock a resource node in order to use it. But a node cannot be locked if any of its descendant or ancestor is locked. You are supposed to: -> write the structure of node -> write codes for * Islock()- returns true if

Re: [algogeeks] Re: Print Hello

2011-03-18 Thread Manikanta Babu
@Saurabh, Sorry buddy, I was trying with g++ compiler, i just tried with gcc and its throwing an error 'error: initializer element is not constant'. I apologise for the mistake. Thanks, Mani On Fri, Mar 18, 2011 at 11:38 AM, saurabh singh wrote: > > @Manikanta Babu. > Dont say you were using de

[algogeeks] [brain teaser ] 18march

2011-03-18 Thread Lavesh Rawat
*A Riddle Problem Solution* * *What is one thing that all wise men, regardless of their religion or politics, agree is between heaven and earth Update Your Answers at : Click Here Solution: Will be updated after 1 day --

[algogeeks] CFP with extended deadline of Mar. 31, 2011: The 2011 International Conference on e-Learning, e-Business, Enterprise Information Systems, and e-Government (EEE'11), USA, July 18-21, 2011

2011-03-18 Thread A. M. G. Solo
Dear Colleagues: Please share the announcement below with those who may be interested. Thank you, Organizing Committee      CALL  FOR  PAPERS        Paper Submission Deadline: March 31, 2011  

Re: [algogeeks] Re: Google puzzles

2011-03-18 Thread murthy.krishn...@gmail.com
hey we can do like dis man using trial and error, so start with m = 15, 22, 29 etc. obviuosly we cant start with 8 as n must be greater than 1. I think u people got the reason for starting with 15(1+14 is divisible by 7), 22(1+21 is divisible by 7) etc. test for m = 15; Day 1:- medals = 1+14/7 =