Re: [algogeeks] C output
9 and 3 -- 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: whats d problem wid using gets?
@harshit it is also possible with scanf(%[^\n]s) for multi word input -- 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] plz xplain the o/p
@piyush the output will hello piyushit's due to following reason you've declared array of 2 pointers to character(char *pstr[2]),which means hello and piyush are stored somewhere else but your array is having only starting addresses of each string.now when you are calling swap function you are passing these addresses as a copy to formal parameters t1 and t2...if you really want to see the change in main function then you have to do call by reference.i.e. instead of sending copy of content of your array of pointers,send the address of that location where your pointer is stored in array of pointers(i.e. send addresses of pstr[0] and pstr[1] instead of sending values of pstr[0] and pstr[1])...for this to work,your function should be swap(char** t1,char** t2){ char *t; t=*t1; *t1=*t2; *t2=t; } if still there is problem then you need to revise concept of pointers...Let Us C or pointer in C would help -- 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 doubt
oh i'm sorry guys galz,its my mistake..actually i forgot to add one more field in struct this is the correct one typedef struct { int bit1:29; int bit2:4; }bit; int main() { printf(%d\n,sizeof(bit)); return 0; } now what will be the output...i'm sure you will amazed to see the result after changing bitfield of bit1 to 28. -- 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] convert a string into another in minimum number of steps
Anup has proposed good solution.use edit distance algorithm and make matrix for insertion and deletion operation. Last entry of the matrix will give the solution which says about minimum possible operation to convert one string to other. -- 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 doubt
@kartik it's wrong output...output will be 8 bytes.I asked this question just to give more clear picture of bit field -- 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: How to save a binary search tree space efficiently
level order traversal can be a solution but since it is BST that we want to store not binary tree(we can store binary tree using level order trav and can reconstruct tree out of it) so we can just store the preorder traversal, at time of reconstructing,scan through this traversal and pass the parent node to child to determine position of child wrt parentdo this for all n nodes -- 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] Explanation
#define g(a) #a replaces any occurrence of g(a) with string a. #define f(a,b) a##b replaces any occurrence of f(a,b) with concatenation of a and b -- 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: How to save a binary search tree space efficiently
@prashant it is the same mid value as u calculate in binary search i.e. (lowest index+highest index)/2 No matter whether it is 18 or 27,u gonna get almost balanced BST every time if u do construct the tree as ankit has mentioned. -- 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 program explain
for(i=0;i16;i++) printf(%d\n,(numi115)? 1:0); consider the above code snippethere at each iteration num is being left shifted,and it is being ANDed with 1000 same at d time. here it is assumed that system is of 16 bit that's why loop is for 16 iterations. it's better to work wid example 23 can be written in binary as 00010111,if each time,this no will be shifted then ANDed with 1000, it will result in only 0(if leftmost bit of shifted no is 0) or 1(if leftmost bit of shifted no is 1)..which eventually will give the binary equivalent of 23 iteration 1 00010111 AND 1000=0 so ternary operator gives output 0 iteration 2 00101110 AND 1000=0 output 0 . . . iteration 11 10111000 AND 1000=1 output 1 . . . ends above outputs are nothing but the bits from left to right of binary equivalent of 23 -- 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] Class Doubt
in c++,classes have some by default feature like they have default constructor,copy constructor and overloaded =operator by default -- 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 doubt
int bit1:1; above definition instructs compiler that use 1 bit for storing integer(signed by default) in bit1. Such notation is used for optimization of memory use. So if someone stores 1 in bit1 then,it will be treated as -1 by compiler since we have instructed the compiler to store it in one bit and since in this case leftmost bit is 1 which will be treated as -1 by the system and output will be -1. -- 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.