[algogeeks] Re: Number of ways for generating n pairs of valid parenthesis

2010-10-04 Thread jayesh
if you are doing the codechef problem . http://www.codechef.com/problems/DCE03/ then using the following relation for finding catalan numbers will be easier since you need to find the answer mod(something)... C(n+1)=sumation(i=0 to n) C(i)*C(n-i) On Oct 1, 8:25 am, Dave wrote: > @Nikhil:

[algogeeks] Re: palindromic base

2010-10-04 Thread jayesh
http://www.codechef.com/problems/K2/ I tried brute force, ie converting the number to base i=2,3,4,5... and so on and checking if its a palindrome or not. My solution is giving tle (of course), will try to think of a better solution otherwise will read the solution. The solutions to this problem a

[algogeeks] Re: fork() problem

2010-09-05 Thread jayesh
and on running this code the process is printd 17 times, how is the answer 19??im getting 31(including the initial process).plz explain. On Sep 6, 7:07 am, PremShankar Kumar wrote: > @Sachin, @Mohit:- > > You are right 19 new processes will get created. Thanks guys. > > #include > #i

[algogeeks] Re: fork() problem

2010-09-05 Thread jayesh
I dont understand, running this code on ideone.com shows create much more than a 50 times On Sep 4, 10:47 pm, PremShankar Kumar wrote: > #include > #include > > using namespace std; > > int Fork() > { > cout<<"\nCREATE \n"; > return fork();} > > int main() > { > Fork(); > Fork() && Fork () |