Re: [algogeeks] Reconstruct BST from preorder traversal
You will also need Inorder traversal data. On Tue, Oct 18, 2011 at 10:12 AM, Ankuj Gupta ankuj2...@gmail.com wrote: How to reconstruct a BST from just the prorder traversal of that tree ? -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Find lowest common ancestor of Binary Tree
http://www.geeksforgeeks.org/archives/1029 On Wed, Sep 28, 2011 at 10:57 AM, Ankuj Gupta ankuj2...@gmail.com wrote: Find lowest common ancestor of Binary Tree -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] plssssssssss replyyyyyyyyyyyyyyyyy
Going by choice of your subject line, none. -- On Sun, Sep 18, 2011 at 10:15 PM, vivek goel vivek.thapar2...@gmail.comwrote: which profile is better?? 1. Technology Consulting 2. Quality Control Analyst Systems if one is from software engg ( programming) background. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks]
You have to use External Merge Sort. -- On Fri, Jul 29, 2011 at 2:58 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: If u have to sort a large amount of data,but the memory space is insufficient for the same...How would u sort the data..? Reply asap everyone.. Thanks in advance...! -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Fwd: SORTING ARRAYS
I don't think so. Try it on {2, 5, 1, 7} and {5, 7, 1, 2} -- On Wed, Jul 27, 2011 at 10:33 AM, Sonal Maheshwari sonal...@gmail.comwrote: i think the following shud work: i=j=0; while(i n jn) // n is the number of elements in the array { if ( a[i] b[j] ) { pos= find(b, a[i]); ///find the position of a[i] in array b swap ( b[j], b[pos] ); //swapping the two numbers } else if ( a[i] b[j] ) { pos= find(a, b[j]); ///find the position of b[j] in array a swap ( a[i], a[pos] ); //swapping the two numbers } i++; j++; } Correct me if m wrong... On Jul 27, 8:46 am, siva viknesh sivavikne...@gmail.com wrote: Given two arrays a[] = {1,3,2,4} b[] = {4,2,3,1} both will have the same numbers but in different combination. We have to sort them . The condition is that you cannot compare only elements within the same array.You can compare element of one array with another only. On Jul 27, 8:45 am, sivaviknesh s sivavikne...@gmail.com wrote: -- Forwarded message -- From: Padmaja Sridharan padmaja...@yahoo.in Date: Wed, Jul 27, 2011 at 5:15 AM Subject: SORTING ARRAYS To: mitcse08i...@googlegroups.com Given two arrays a[] = {1,3,2,4} b[] = {4,2,3,1} both will have the same numbers but in different combination. We have to sort them . The condition is that you cannot compare only elements within the same array.You can compare element of one array with another only. ~With Regards Padmaja -- Regards, $iva -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS interview:
Implement Preorder Traversal in the File system tree. -- On Wed, Jul 27, 2011 at 12:06 PM, geek forgeek geekhori...@gmail.comwrote: Function to display the directory structure in a user friendly way taking root dir as arg for a general OS. You may assume and state some basic APIs available in that OS -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] The Google Resume
Here: http://goo.gl/pDG5s (Yes, that's the correct link) -- On Wed, Jul 27, 2011 at 1:18 PM, malay chakrabarti m1234...@gmail.comwrote: plz send it to my maid id also . thanks in advance :) On Wed, Jul 27, 2011 at 12:46 PM, Prem Krishna Chettri hprem...@gmail.com wrote: Anyone got this book?? pdf.. or URL link is highly appreciated. Thx.. On Tue, Jul 26, 2011 at 8:37 PM, Ankur Garg ankurga...@gmail.com wrote: +1 Me too looking out for the same :( On Tue, Jul 26, 2011 at 7:10 PM, Saravanan T mail2sarava...@gmail.comwrote: +1 Pls send to my email id as well.. On Tue, Jul 26, 2011 at 7:09 PM, Akshata Sharma akshatasharm...@gmail.com wrote: Anyone having the Google Resume book pdf? -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Fwd: SORTING ARRAYS
Another point of view: Since both the arrays have same elements, sorting one sorts both. Hence we can use elements of array1 to build a min-heap in array2. Then read mins from array2 into array1, getting array1 sorted. Copy array1 to array2. Does this violate the comparison rule set? -- On Wed, Jul 27, 2011 at 1:46 PM, sagar pareek sagarpar...@gmail.com wrote: selection sort is best to do this find the number of elements smaller or equal then the ith element of ather array and swap it accordingly On Wed, Jul 27, 2011 at 12:28 PM, ankit sambyal ankitsamb...@gmail.comwrote: Following is the working code :Time complexity : O(n^2) Space complexity : O(1) void swap(int *a,int *b) { int temp; temp=*a; *a=*b; *b=temp; } /*num is the number which is searched in the array arr[]. index is the index in the array arr[] by which the searched number is to be replaced*/ int searchAndReplace(int arr[],int size,int num,int index) { int i=index+1; while(isize) { if(arr[i]==num) break; i++; } if(isize) swap(arr[i],arr[index]); } void sort(int arr1[],int arr2[],int size) { int i=0,j; while(isize) { j=0; while(jsize) { if(arr2[j]arr1[i]) searchAndReplace(arr1,size,arr2[j],i); j++; } i++; } } int main() { int arr1[]={2,5,1,7}; int arr2[]={5,7,1,2}; sort(arr1,arr2,4); int i; for(i=0;i4;i++) printf(%d ,arr1[i]); return 0; } -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Fwd: SORTING ARRAYS
@ankit: you are right. While building is okay (item to insert is from other array, hence comparison to that allowed), deletemin() will violate the condition given. -- On Wed, Jul 27, 2011 at 2:03 PM, ankit sambyal ankitsamb...@gmail.comwrote: @anand: How are you building minheap ?? Comparison of same array elements is not allowed ! -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: Re : [algogeeks] Re: size of self referential structure
On Wed, Jul 27, 2011 at 2:18 PM, hary rathor harry.rat...@gmail.com wrote: @sunny : what you means by machine dependent means 64 bit: you means by compiler / operating system /computer architecture ? because i never get size of pointer 8 byte. if your statement true then tell me which compiler / operating system /computer architecture i should have get this output 8. A 64 bit machine running a 64 bit OS, on which using a compiler targeted for 64 bit executable will give you pointer size of 8. -- -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] AMAZON Q
Construct a BST using ar[], where each node contains the ar index information as well (in addition to the value). Now iterating through ar. For each element, traverse the BST by value, counting only those nodes where the value AND index# are greater then self. Once done traversal, update ar_low. -- On Tue, Jul 26, 2011 at 7:18 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: You have an array like ar[]= {1,3,2,4,5,4,2}. You need to create another array ar_low[] such that ar_low[i] = number of elements lower than or equal to ar[i] in ar[i+1:n-1]. So the output of above should be {0,2,1,2,2,1,0} Time complexity : O(nlogn) use of extra space allowed. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Adding w/o +
On Wed, Jul 13, 2011 at 2:22 PM, Amit Gupta amit070...@gmail.com wrote: You can try this also do { sum = a ^ b; carry = a b; *carry = 0x1u;* a = sum; b = carry; }while (carry!=0); I think one step is missing here, no? (I have added in bold) -- -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Search node in a binary tree
On Wed, Jul 13, 2011 at 1:40 PM, sameer.mut...@gmail.com sameer.mut...@gmail.com wrote: Guys i always have this doubt.Please tell me whether stack frames allocated for each recursive call will be cleared if we return in the middle of a recursive call? In normal condition, the return statement will take the control to the functions's caller, which might be the function itself if its a recursive call. There is no way to return to the original caller, who called your recursive function, without skipping the stack. I think the only way to skip to the original caller, is by throwing an exception from the recursive function, which is caught by the original caller. The exception will unwind the stack till someone catches it. -- -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Reversing the order of words in String
On Wed, Jul 13, 2011 at 7:32 AM, Gene gene.ress...@gmail.com wrote: You can recognize a word W, recur to print the rest of the words in reverse, then print W: #include stdio.h #include string.h void print_words_in_reverse(char *s) { char *e; while (isspace(*s)) s++; if (*s == '\0') return; e = s + 1; while (*e !isspace(*e)) e++; print_words_in_reverse(e); printf(%.*s , e - s, s); } int main(void) { char line[16 * 1024]; fgets(line, sizeof line, stdin); print_words_in_reverse(line); return 0; } Nice. Here is a similar version which, instead of printing, reverses the string in place in O(n), if that's what's needed. http://ideone.com/nHcQ3 http://www.ideone.com/tA6rS -- -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] # References !!!!
Yep, and http://www.parashift.com/c++-faq-lite/references.html#faq-8.5 -- On Tue, Jul 12, 2011 at 12:50 PM, sunny agrawal sunny816.i...@gmail.comwrote: Once a reference is initialized to an object, it cannot be changed to refer to another object. Ref. Bruce Eckel - ch11 So its Not possible -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks]
Also - new and delete are typesafe, hence better. (malloc returns void*) - new gives you the feature of placement new, which allows you create an object in a pre-determined location, which is helpful I think in device drivers programming... -- On Tue, Jul 12, 2011 at 10:39 AM, sagar pareek sagarpar...@gmail.comwrote: new and delete operator calls condtructors and destructors respectively :) On Wed, Jul 6, 2011 at 6:23 PM, Navneet Gupta navneetn...@gmail.comwrote: The basic reason is graduation. Since C++ is object oriented and designers wanted to provide more safety in case of dynamic memory allocations, they defined new and delete operators to handle allocation and deallocation. If you see malloc, if does only one function - allocate the memory, with new operator on an object, it's appropriate constuctor will be called and you are guaranteed with proper initialization specially when we use standard libraries. So new faciliates allocation as well as initialization, similarly delete faciliates deallocation as well as destruction (clean up code inside destructor function). With free, user won't be having any handle on object if allocated with new until it is allocated memory and appropriately initialized. Also, AFAIK, chances of getting proper memory allocation are more with new than malloc. Somebody on the group may confirm. On Wed, Jul 6, 2011 at 6:07 PM, Tamanna Afroze afroze...@gmail.com wrote: I think C++ has some advanced feature for memory allocation like new. On Wed, Jul 6, 2011 at 6:34 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: Why is it suggested not to use malloc() or calloc() in C++ for memory allocation? -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. Regards, Tamanna -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Navneet -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: C OUTPUT HELP
But this works, where I have both the variable name and function name used: #includestdio.hint charu(int x);int charu(int x) { return x; } main(){* int a = charu(45); int charu = a;* int scanf=78; //int printf=45; int getchar=6; printf(%d,charu); //error if this line is uncommented charu=charu(6); printf(\n%d,getchar); puts(Wow it ran); } http://ideone.com/xN2yi Local variable names trump function names. You can call the function as long as compilers doesn't come across a local variable of same name. Once it does that, call to the function will give compiler error. (This is not an authoritative answer. This is from what I observe them behaving as) -- On Tue, Jul 12, 2011 at 1:14 PM, saurabh singh saurab...@gmail.com wrote: For 1st problem learn the concepts of linking.Scanf hasn't been required to link yet in the main. So during compling the program doesn't give any special treatment to scanf. check this, #includestdio.h int charu(int x); int charu(int x) { return x; } main() { int charu=67; int scanf=78; //int printf=45; int getchar=6; printf(%d,charu); //error if this line is uncommented charu=charu(6); printf(\n%d,getchar); puts(Wow it ran); } On Tue, Jul 12, 2011 at 1:03 PM, Abhi abhi123khat...@gmail.com wrote: PROBLEM 2: First all the expressions are evauated from right to left in printf() and then results printed with tha final value of i. -- 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/-/9uxWDI2wuhwJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C OUTPUT HELP
On Tue, Jul 12, 2011 at 1:29 AM, nicks crazy.logic.k...@gmail.com wrote: *PROBLEM 3.* * * #includestdio.h main() { enum {low='a',high='b'}tag; char try=low; printf(Size=%d,sizeof(tag)); switch (try) { case 'a':printf(aaa);break; case 'b':printf(bbb); case 'c':printf(ccc); } //system(pause); } in this program size of enum comes out to be 4..help me in understanding the size of enum...how it is stored in memory??...does the size of enum depend on number of constant in it ?anyone link regarding that ?? What will be interesting to see here is: printf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(Size = %d\n,sizeof(tag));printf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(Size = %d\n,sizeof(low)); We will get 4 and 4. 'tag' is the optional identifier, 'low' is an enumerated type. From C99, for tag: The expression that defines the value of an enumeration constant shall be an integer constant expression that has a value representable as an int. for low: Each enumerated type shall be compatible with char, a signed integer type, or an unsigned integer type. The choice of type is implementation-defined, but shall be capable of representing the values of all the members of the enumeration. The enumerated type is incomplete until after the } that terminates the list of enumerator declarations. PS: I didn't know the exact constraints too, thanks to nicks for bringing up this question. -- -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C OUTPUT HELP
On Tue, Jul 12, 2011 at 2:36 PM, nicks crazy.logic.k...@gmail.com wrote: and in problem 3 what i understood after reading with what you wrote is that size of tag will remain sizeof(int) irrespective of the number of constants in it.correct me if i am wrong !! Right. -- -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] # References !!!!
Which compiler? http://www.ideone.com/7nnse -- On Tue, Jul 12, 2011 at 5:42 PM, Ashish kumar Jain akjlucky4...@gmail.comwrote: You think so! Time to think again. :) #includeiostream using namespace std; int main(void) { int a=10 ,b=4; int c=a; cout\n-a; a+=20; cout\n-c; // //Addyour code here. *(unsigned long*)(((unsigned long)b)-((unsigned long)a-(unsigned long)b)) = (unsigned long)b; /*/ cout\n-c; c=999; cout\n-b; cin.get(); return 0; } On Tue, Jul 12, 2011 at 1:06 PM, Anand Saha anands...@gmail.com wrote: Yep, and http://www.parashift.com/c++-faq-lite/references.html#faq-8.5 -- On Tue, Jul 12, 2011 at 12:50 PM, sunny agrawal sunny816.i...@gmail.comwrote: Once a reference is initialized to an object, it cannot be changed to refer to another object. Ref. Bruce Eckel - ch11 So its Not possible -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Ashish -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.