Re: [algogeeks] novel written test

2011-06-27 Thread gmagog...@gmail.com
Is it required that no two sons have the same age? >From my view, the clue "my youngest is the youngest" only defines the requirement that "the youngest one is unique", but he can still have two older brothers of the same age. Please correct me if this is wrong. Yanan Cao On Mon, Jun 27, 2011

Re: [algogeeks] novel written test

2011-06-27 Thread gmagog...@gmail.com
if( links can be melt and made into smaller links ) { return 1; } else { return 2; } Yanan Cao On Mon, Jun 27, 2011 at 4:09 PM, sourabh jakhar wrote: > two > > > On Tue, Jun 28, 2011 at 2:23 AM, amit the cool wrote: > >> A chain is broken into three pieces of equal lengths containing 3

Re: [algogeeks] C concept on memory layout

2012-02-06 Thread gmagog...@gmail.com
I think you are right about p being in BSS segment and it does last even the function finishes, however, you may need a pointer to get the data out of p. Then you can read the data. Correct me if i am wrong On Mon, Feb 6, 2012 at 1:04 PM, Ravi Ranjan wrote: > i have a confusion in it > > #incl

Re: [algogeeks]

2012-08-21 Thread gmagog...@gmail.com
what type is x? Yanan Cao On Tue, Aug 21, 2012 at 9:25 AM, Wladimir Tavares wrote: > Somebody could explain to me why this happen: > x = (1<<31); > printf("%d\n",x); > if(x<0) x = -x; > printf("%d\n",x); > > Output: > > -2147483648 > -2147483648 > > Wladimir Araujo Tavares > *Federal Univ

Re: [algogeeks] Re:

2012-08-21 Thread gmagog...@gmail.com
@dave Nice explanation! Yanan Cao On Tue, Aug 21, 2012 at 10:32 AM, Dave wrote: > @Wladimirufc: You responded that the type is int. This data type (usually) > is 32 bits in length, and stores integers in the twos-complement number > system. See http://en.wikipedia.org/wiki/Two%27s_complement

Re: [algogeeks] help with o/p why 0 comes???

2013-02-28 Thread gmagog...@gmail.com
I think this is because of type mismatch. You are enforcing your program to read a floating point number in the way of reading a integer. And they have totally different format. If you have -Wall turned on, you should see a warning. Yanan Cao On Thu, Feb 28, 2013 at 1:41 PM, Shubham Sandeep wro

Re: [algogeeks] C output

2011-08-22 Thread gmagog...@gmail.com
output is 10 using gcc 4.5.2 Yanan Cao On Mon, Aug 22, 2011 at 2:18 PM, sagar pareek wrote: > Yeah its o/p is 10 :) > > > On Tue, Aug 23, 2011 at 12:45 AM, Deepak Garg wrote: > >> its output is >> >> 10 >> >> >> On Tue, Aug 23, 2011 at 12:03 AM, rohit wrote: >> >>> #include >>> >>> #define m

Re: [algogeeks] Re: question on fork()

2011-08-22 Thread gmagog...@gmail.com
I am getting 6 red and 8 green as expected using the original code Yanan Cao On Mon, Aug 22, 2011 at 2:38 PM, Yasir wrote: > Surprisingly, if I comment the last if condition ( which is AFTER red() > call ), it is printing red only 6 times as expected.. > http://ideone.com/XMHzC > > main() > {

Re: [algogeeks] Re: question on fork()

2011-08-22 Thread gmagog...@gmail.com
Infinite times Yanan Cao On Mon, Aug 22, 2011 at 2:43 PM, Don wrote: > // DO NOT RUN THIS! By inspection, how many times will it print "Hello > world"? > // If you find out by running it, that is cheating. Don't do it! > int main() > { > int i=0, j=0; > for(i = 0; i*j < 20; ++i) > { >if

Re: [algogeeks] apti!

2011-08-26 Thread gmagog...@gmail.com
20? Yanan Cao On Fri, Aug 26, 2011 at 1:12 PM, priya ramesh < love.for.programm...@gmail.com> wrote: > A certain number of men can finish a piece of work in 10 days. If however > there were 10 men less it will take 10 days more for the work to be > finished. How > many men were there originall

Re: [algogeeks] apti!

2011-08-26 Thread gmagog...@gmail.com
@Rahul Assume the productivity of each man is the same let original number of man be x The total workload= x*10*p also workload = (x-10)(10+10)*p solve it so x=20 Yanan Cao On Fri, Aug 26, 2011 at 1:21 PM, Rahul Verma wrote: > @yanan how it is 20. > > Rahul Verma > > -- > You received thi

Re: [algogeeks] Aps

2011-09-07 Thread gmagog...@gmail.com
First number: 16 second : 61 third: 106 speed: 45 Yanan Cao On Wed, Sep 7, 2011 at 10:09 AM, Mani Bharathi wrote: > While traveling at uniform speed. U read a two digit no. after one hr > the number is reversed order. After another hour the number read is same > two digit number. What is the

Re: [algogeeks] Re: Aps

2011-09-07 Thread gmagog...@gmail.com
lmao Yanan Cao On Wed, Sep 7, 2011 at 10:14 AM, Don wrote: > Clearly you are sitting still looking at a "Route 66" sign. > Don > > On Sep 7, 10:09 am, Mani Bharathi wrote: > > While traveling at uniform speed. U read a two digit no. after one hr > > the number is reversed order. After anothe

Re: [algogeeks] MS written test

2011-09-07 Thread gmagog...@gmail.com
0xa == 0x 1010, which stands for all the even bits 0x5 == 0x 0101, which stands for all the odd bits >>1 and <<1 means shifting odd to even and even to odd then | means putting new even bits and odd bits together Yanan Cao On Wed, Sep 7, 2011 at 10:23 AM, teja bala wrote: > > Can anyone plzz

Re: [algogeeks] How to print numbers from 1 to 100 without loop , without recursion , without #define statements , without goto statement

2011-03-16 Thread gmagog...@gmail.com
printf("1 2 3 4 5 6 7 8 9 10 11 12 13..."); no loop, no recursion, no define, no goto. HAHA : ) On Wed, Mar 16, 2011 at 12:30 PM, Carl Barton wrote: > @kumar Your example is still recursion > > > On 16 March 2011 16:46, kumar anurag wrote: > >> ok guys... >> >> >> On Wed, Mar 1

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