Re: [algogeeks] My senior's Interview Experience at Microsoft who got selected and offered a 16lacks package

2011-08-05 Thread Poised~
@ Wastrel and Niteesh Mehra: I tried running the code: char *str; strcpy(str, junk); this gave a segmentation fault on Ubuntu 11.04 gcc-4.5.2 (32 bit OS) I think we should consider the general concept that a pointer cannot be used until it is assigned some memory. -- You received this

Re: [algogeeks] hash table

2011-08-05 Thread saurabh singh
How can the element be regained from hash table? On Sat, Aug 6, 2011 at 2:41 AM, mohit verma mohit89m...@gmail.com wrote: yes you can... for randomness , the key value will be key=rand() and now implement your hash function with this key. On Fri, Aug 5, 2011 at 4:53 PM, Kamakshii Aggarwal

Re: [algogeeks]

2011-08-05 Thread Dipankar Patro
Try a dry run on the following linked list 1-2-3-4-5-6-Null head is a global variable; The recursion will take place till 6 and assign head address of 6; then it will first change 5-6-(back to 5) [root-next-next = root] when it will be back to 4, change 4-5-(back to 4) . at this stage the

[algogeeks] Re: adobe

2011-08-05 Thread sumit
This looks quite simple. Every number ending in 3 follows a pattern.eg- 3 - 111 13 - 11 23 - 1 etc we can find the reauired no. by : suppose input no. is 33 In every case leave the no at 1's place(least significant) i.e. 3, In 33 you will be left with 3(after removal of 3 at first

[algogeeks] Re: difference between the two

2011-08-05 Thread shiv narayan
according to me 2nd structure must also have 16 bit size for 64 bit architecture as padding must also take place there also. On Aug 6, 4:10 am, Shashank Jain shashan...@gmail.com wrote: i dont understand the diff btw dem, could u plz elaborate? Shashank Jain IIIrd year Computer Engineering

Re: [algogeeks] Re: adobe

2011-08-05 Thread sahil gujral
yes u r wrong.. 1 is nt divisible by 23 On Sat, Aug 6, 2011 at 9:15 AM, sumit sumitispar...@gmail.com wrote: This looks quite simple. Every number ending in 3 follows a pattern.eg- 3 - 111 13 - 11 23 - 1 etc we can find the reauired no. by : suppose input no. is 33 In

Re: [algogeeks] difference between the two

2011-08-05 Thread Tushar Bindal
http://www.serc.iisc.ernet.in/ComputingFacilities/systems/cluster/xlf/html/xlfug/ug35.htm this says int is always 4 bytes and pointer is 8 bytes on 64 bit compiler. so how does padding affect these structures because of the difference in size of int and pointer? I tried this program

Re: [algogeeks] My senior's Interview Experience at Microsoft who got selected and offered a 16lacks package

2011-08-05 Thread Niteesh Mehra
Right. But why does my compiler behave weirdly -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/iWbW5rOYO1EJ. To post to this group, send email to

[algogeeks] sizeof structure

2011-08-05 Thread Sabya Sachi
At many places, it has been mentioned that in C, a structure (when not packed) pads its content so as to facilitate memory alignment so that its members are accessed faster. like for e.g the snippet struct node { char d; int a; }; int main(){ struct node a; printf(size = %d,sizeof(a)); }

Re: [algogeeks] Re: output???

2011-08-05 Thread sagar pareek
see what piyush posted On Sat, Aug 6, 2011 at 4:35 AM, Shashank Jain shashan...@gmail.com wrote: sagar - i dint get u, d code thing! Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Sat, Aug 6, 2011 at 2:31 AM, sagar pareek sagarpar...@gmail.comwrote:

Re: [algogeeks] Re: output???

2011-08-05 Thread saurabh singh
IEEE notation.. they appear to be the same but they are not same..0.5d has higher precision that does not necessarily means its larger.. On Sat, Aug 6, 2011 at 10:20 AM, sagar pareek sagarpar...@gmail.com wrote: see what piyush posted On Sat, Aug 6, 2011 at 4:35 AM, Shashank

[algogeeks] output

2011-08-05 Thread ranjane
# define swap(a,b) temp=a; a=b; b=temp; main( ) { int i, j, temp; i=5; j=10; temp=0; if( i j) swap( i, j ); printf( “%d %d %d”, i, j, temp); } On compiling i got ans 10, 0, 0.explain.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] output

2011-08-05 Thread saurabh singh
hint:MACRo is just substituted as it is On Sat, Aug 6, 2011 at 10:23 AM, ranjane ranjane...@gmail.com wrote: # define swap(a,b) temp=a; a=b; b=temp; main( ) { int i, j, temp; i=5; j=10; temp=0; if( i j) swap( i, j ); printf( “%d %d %d”, i, j, temp); } On compiling i got ans

Re: [algogeeks] output

2011-08-05 Thread saurabh singh
Try compiling with gcc -E filename.c.That will clear everything On Sat, Aug 6, 2011 at 10:25 AM, saurabh singh saurab...@gmail.com wrote: hint:MACRo is just substituted as it is On Sat, Aug 6, 2011 at 10:23 AM, ranjane ranjane...@gmail.com wrote: # define swap(a,b) temp=a; a=b;

Re: [algogeeks] Re: output???

2011-08-05 Thread sagar pareek
@saurabh what? i didnt get you On Sat, Aug 6, 2011 at 10:22 AM, saurabh singh saurab...@gmail.com wrote: IEEE notation.. they appear to be the same but they are not same..0.5d has higher precision that does not necessarily means its larger.. On Sat, Aug 6, 2011 at 10:20 AM,

Re: [algogeeks] output

2011-08-05 Thread loka ranjane
@saurabh:ya got it..thanks On Sat, Aug 6, 2011 at 10:26 AM, saurabh singh saurab...@gmail.com wrote: Try compiling with gcc -E filename.c.That will clear everything On Sat, Aug 6, 2011 at 10:25 AM, saurabh singh saurab...@gmail.com wrote: hint:MACRo is just substituted as it is On

Re: [algogeeks] Re: output???

2011-08-05 Thread saurabh singh
a double has a higher precision than float i.e. it has larger number of bits for the mantisa part. when float is compared to double it is promoted to double by filling remaining bits in mantissa with 0. consider this code http://ideone.com/y1Ahu http://ideone.com/y1AhuIts equal bcoz the

Re: [algogeeks] output

2011-08-05 Thread Pramod Jayswal
when swap is called ,as it is a macro ,before compilation its code is replaced and the code before compilation bcomes: # define swap(a,b) temp=a; a=b; b=temp; main( ) { int i, j, temp; i=5; j=10; temp=0; if( i j) //code replaced here temp=a; //not executed (false) a=b;

Re: [algogeeks] Re: Duplicates in a string

2011-08-05 Thread kumar raja
@hary : Ur solution is good... But if the problem is modified so that the string can contain alphanumeric characters is there any better way to do it.. On 5 August 2011 23:11, hary rathor harry.rat...@gmail.com wrote: i have used 26 bit of checker variable then i have checked in if statemet

[algogeeks] Radix sort in linear time???

2011-08-05 Thread kumar raja
suppose i have 6 numbers 379,635,274,743,980,835 i read that radix sort runs in O(d(n+k)) time. where d-number of digits ,n=6,k=each digit range. But after the elements are sorted on LSB ,to find next digit we need to perform / and % operation 379 /10 = 37 and 37 %10= 7 so it is taking

Re: [algogeeks] pls help

2011-08-05 Thread Tushar Bindal
@gaurav didn't get this: Just to increase the size of the string by one. Then you can put any character at the the new last position, which is 'l'. can u pls explain that? On Fri, Aug 5, 2011 at 2:57 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote: Ok, Thanks On Fri, Aug 5, 2011 at 2:53

<    1   2   3