Re: [algogeeks] How to identify what is stored in union in c language

2011-02-22 Thread Rajiv Podar
lve your case. Thanks & Regards, Rajiv Podar On Tue, Feb 22, 2011 at 12:59 PM, Rajiv Podar wrote: > Hi Shiva, > > There is no as such way to know what type of value is stored in the Union > (as per my knowledge) > But you can try the following code in order to keep tra

Re: [algogeeks] How to identify what is stored in union in c language

2011-02-21 Thread Rajiv Podar
intf("%f\n", data.m_floatValue); if (m_charValue.m_dataType == CHAR) printf("%c\n", data.m_charValue); else printf("bad type %d in utype\n", utype); I hope this will solve your case. Thanks & Regards, Rajiv Podar On Tue, Feb 22, 2011 at 12

Re: [algogeeks] missing element limited resource

2011-02-07 Thread Rajiv Podar
Read data and store in std::map and then check for it Thanks & Regards, Rajiv Podar On Mon, Feb 7, 2011 at 3:33 PM, snehal jain wrote: > given file containing roughly 300 million social security nos. ( 9 > digit nos.) find a 9 digit no. that is not in the file. you have > un

Re: [algogeeks] array(amazon && microsoft)

2011-02-07 Thread Rajiv Podar
Printing in the normal order will print the sorted output. starting from Value[0][0] to value [m][n]. OR Please provide a e.g. array which need to be printed if I am wrong. Thanks & Regards, Rajiv Podar On Mon, Feb 7, 2011 at 2:13 PM, jalaj jaiswal wrote: > You are given a array wi

Re: [algogeeks] Re: C++ Riddle

2011-02-06 Thread Rajiv Podar
for e.g. u can use "<<" operator. int a = 1; a = a <<1; a become 2; Or u cannot use any &, |, ^ operations. Thanks & Regards, Rajiv Podar On Mon, Feb 7, 2011 at 12:33 PM, jagannath prasad das wrote: > bit operation means what? > > On Mon, Feb

Re: [algogeeks] Re: C++ Riddle

2011-02-06 Thread Rajiv Podar
@Dave: ++ and -- are arithmetic operations. @Jalaj: I agree with the above solution Thanks & Regards, Rajiv Podar On Mon, Feb 7, 2011 at 11:47 AM, jalaj jaiswal wrote: > try this > > let nos be m & n > > char * p; > p=m; > int sum = (int)&p[n] ; >

Re: [algogeeks] Re: Good question

2011-02-06 Thread Rajiv Podar
Hi Try following code Suppose we need to find size of variable *"obj"* int size = (char*)(obj +1 ) - (char*)(obj); * *Thanks & Regards, Ricky On Mon, Feb 7, 2011 at 12:19 AM, albert theboss wrote: > using this macro > > size(X) ((X*)0+1) > > > > if we give size(int) it ll return 4. > size(d

Re: [algogeeks] Re: Minimum positive-sum subarray

2011-02-03 Thread Rajiv Podar
s asking for minimum > > On Thu, Feb 3, 2011 at 11:34 PM, Rajiv Podar wrote: > >> Hi Richi, >> >> Thanks for finding the problem. I forgot to add one condition: >> Please have a look on the following code. I hope this will solve the >> problem. >> >&g

Re: [algogeeks] Re: Minimum positive-sum subarray

2011-02-03 Thread Rajiv Podar
Hi Richi, Thanks for finding the problem. I forgot to add one condition: Please have a look on the following code. I hope this will solve the problem. int array[] = {-1,-2,3,4}; int length = 4; int max = 0; int current = 0; for (int i = 0; i < length; i++) { current += array[i]; if (current <

Re: [algogeeks] Puzzle to Puzzle you Part _ 1

2011-02-02 Thread Rajiv Podar
Hi Bhavesh, Blind man has to create two piles of his own so he dont know which pile have how much up face cards Thanks & Regards, Rajiv Podar On Thu, Feb 3, 2011 at 10:42 AM, Bhavesh agrawal wrote: > IS FACING UP CARDS ARE RANDOMLY DISTRIBUTED IN THE PILE > > On Thu, Feb