Re: [algogeeks] sol
If a,b are not equal then this statement will always return true status as a^b=true so true bit-wise or-ed with anyone will return true. On Sun, Aug 21, 2011 at 10:38 AM, SHUBHAM BANSAL shubham.bans...@gmail.comwrote: ((a^b) | ((ab)1)) sorry tht was bitwise or..by mistak i hd wrote logicl or SHUBHAM BANSAL COMP DEPT.. NIT KKr On Sun, Aug 21, 2011 at 9:30 AM, Sanjay Rajpal srn...@gmail.com wrote: Yes if a or b are non zero, the result is always 1. Sanju :) On Sat, Aug 20, 2011 at 8:57 PM, Naman Mahor naman.ma...@gmail.comwrote: @sanjay assume that the value of a=0,b=0; so a^b=0 and (ab)1 =0 so answer will zero. so the result will not always 1. it can be 0 or 1 depends on the value of a n b. On Sun, Aug 21, 2011 at 12:12 AM, Sanjay Rajpal srn...@gmail.comwrote: || is a short-circuit operator(LOGICAL OR). if first condition is true, then second is not evaluated, only if first is false, second is evaluated. If a==b, then second condition will evaluate to true, else first condition will be evaluated, which are true here both. So the result is always 1. Sanju :) On Sat, Aug 20, 2011 at 11:37 AM, Atul Modi atul.a...@gmail.comwrote: || is not bitwise or...it is logical orso it is basically for the two ops (a^b) being succesful n (ab)1 returning 1 on successthus the ans. is 1 i think On Sat, Aug 20, 2011 at 11:59 PM, Aditya Virmani virmanisadi...@gmail.com wrote: @priya..wht if a=b=0 ? or a=b= 1000 On Sat, Aug 20, 2011 at 11:33 PM, priya ramesh love.for.programm...@gmail.com wrote: the answer is 1 sum=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. -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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: Puzzle
only M is married. On Sat, Aug 20, 2011 at 7:53 PM, Arun Vishwanathan aaron.nar...@gmail.comwrote: @DK:if L is married to M according to you finally , then what does the third if then statement according to you mean when it is given that if L is not married then M is married? On Fri, Aug 19, 2011 at 10:35 PM, Dave dave_and_da...@juno.com wrote: @DK: What in the statement of the problem led you to believe that these were if-then statements? Dave On Aug 19, 3:15 pm, DK divyekap...@gmail.com wrote: Note that in the answer above, the table given is of the form: If condition is truethen what predicate is true ----- M - married N - not married N - married L - not married L - not married M - married -- DK http://gplus.to/divyekapoorhttp://twitter.com/divyekapoorhttp://www.divye.in -- 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. -- People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily. -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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++
It will show error On Sun, Aug 21, 2011 at 12:21 PM, Sanjay Rajpal srn...@gmail.com wrote: I think it will not be an error. This is because X() will create a temporary object, and when the object is returned in the function calling it, then default copy constructor will do bitwise copy of data members in the calling function. Correct me if m wrong. On 8/20/11, sachin sabbarwal algowithsac...@gmail.com wrote: class X() { X() { } X fun() { return X(); //error or what?? because constructor never returns anything so what this return statement will receive after executing x() and what it will return?? } }; -- 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. -- Sanju :) -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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.
[algogeeks]
class base { public: int bval; base(){bval=0;} }; class deri:public base { public: int dval; deri(){dval=1;} }; void SomeFunc(base *arr,int size) { for(int i=0; isize; i++,arr++) coutarr-bval; coutendl; } int main() { base BaseArr[5]; SomeFunc(BaseArr,5); deri DeriArr[5]; SomeFunc(DeriArr,5); system(pause); return 0; } 0 01010 Will somebody tell me why it's showing this..?? -- With regards Puneet -- 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]
Wil u please explain in context of o/p.means how 1 whn SomeFunc(DeriArr,5); stmt is executed how 0 and 1 will come..??? On Sun, Aug 21, 2011 at 12:40 PM, Naman Mahor naman.ma...@gmail.com wrote: because the pointer of base class will move by 2 bytes every time but the size of derived class is 4 byte. On Sun, Aug 21, 2011 at 12:31 PM, Puneet Chawla puneetchawla...@gmail.com wrote: class base { public: int bval; base(){bval=0;} }; class deri:public base { public: int dval; deri(){dval=1;} }; void SomeFunc(base *arr,int size) { for(int i=0; isize; i++,arr++) coutarr-bval; coutendl; } int main() { base BaseArr[5]; SomeFunc(BaseArr,5); deri DeriArr[5]; SomeFunc(DeriArr,5); system(pause); return 0; } 0 01010 Will somebody tell me why it's showing this..?? -- With regards Puneet -- 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. -- With regards Puneet -- 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] array problem
Similary as we are counting set bits count 0's nd cmpare nd set 1 if coutn(1)count(0) for each integer in array On Sun, Aug 21, 2011 at 1:44 PM, Sanjay Rajpal srn...@gmail.com wrote: @Dheeraj : I think u should review the problem again. What u have posted is a way to find no. of set bits in a number. But problem is check a bit at a position in all number for no. of 1s and 0s, not in a single number. This has to be done for all 32 bits. Sanju :) On Sun, Aug 21, 2011 at 1:11 AM, Dheeraj Sharma dheerajsharma1...@gmail.com wrote: while(a) ( a=(a-1) count++ ) counts number of 1s in number 'a'.. Loop can be breaken if count exceeds 16.. On 8/21/11, himanshu kansal himanshukansal...@gmail.com wrote: problem: There is an array containing integers. for every bit in the integer,you have to print a 1 if no of 1s corresponding to that bit is more than no of 0s corresponding to that bit (counting that bit in all the integers) otherwise print a 0(if no of 0s corresponding to that bit are more). this you have to do for all bits in the integers. assumption:integers are of 32bits. no of integers in array are odd...(i.e. there is no case like no. of 1s=no. of 0s) i have done this by counting the no of 1s and 0s for all bits. but can anyone suggest any other efficient approach (somewhat using bitwise operators). -- 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. -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- 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. -- With regards Puneet -- 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-Question
Compiler is little endian so as u have typecasted it to char pointer then 0100 1010 1100 means 4 0 A C 0 0 0 0 it will show o/p byte by byte from LSB. On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar vijaykhand...@gmail.comwrote: Thank u very much Abhishek for this link, Now I got it ...But also u explain me in following.. 5.375 is represents 0100 1010 1100 means 4 0 A C 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3] how these r printing 0 0 AC 40plz Explain On Sun, Aug 21, 2011 at 4:57 PM, Abhishek mailatabhishekgu...@gmail.comwrote: check this link.. http://en.wikipedia.org/wiki/Single_precision_floating-point_format -- 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/-/OTIkO_pXQMgJ. 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. -- With regards Puneet -- 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-Question
forgot to mention last byte 00 then 2nd last 00 and so on AC then 40 On Sun, Aug 21, 2011 at 6:00 PM, Puneet Chawla puneetchawla...@gmail.comwrote: Compiler is little endian so as u have typecasted it to char pointer then 0100 1010 1100 means 4 0 A C 0 0 0 0 it will show o/p byte by byte from LSB. On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar vijaykhand...@gmail.comwrote: Thank u very much Abhishek for this link, Now I got it ...But also u explain me in following.. 5.375 is represents 0100 1010 1100 means 4 0 A C 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3] how these r printing 0 0 AC 40plz Explain On Sun, Aug 21, 2011 at 4:57 PM, Abhishek mailatabhishekgu...@gmail.com wrote: check this link.. http://en.wikipedia.org/wiki/Single_precision_floating-point_format -- 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/-/OTIkO_pXQMgJ. 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. -- With regards Puneet -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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++
Confused don't know the reason why the copy constructor is not called nor that = operator overloading..plzzz help me out..!!! On Sun, Aug 21, 2011 at 10:33 PM, Thayumanavar S thayum...@gmail.comwrote: folks during temporary object creation constructor is called right..but constructor is called here only 2 times.. According to me,either copy constructor and constructor should have been called 2 times both or constructor 4 times ..but its neither of them...paradox http://en.wikipedia.org/wiki/Return_value_optimization thayumanavar s -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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++
yeah thnx..:) On Sun, Aug 21, 2011 at 10:46 PM, Sanjay Rajpal srn...@gmail.com wrote: Depends on compiler . Return Value optimization : See the link : http://en.wikipedia.org/wiki/Return_value_optimization Sanju :) On Sun, Aug 21, 2011 at 10:11 AM, Puneet Chawla puneetchawla...@gmail.com wrote: Confused don't know the reason why the copy constructor is not called nor that = operator overloading..plzzz help me out..!!! On Sun, Aug 21, 2011 at 10:33 PM, Thayumanavar S thayum...@gmail.comwrote: folks during temporary object creation constructor is called right..but constructor is called here only 2 times.. According to me,either copy constructor and constructor should have been called 2 times both or constructor 4 times ..but its neither of them...paradox http://en.wikipedia.org/wiki/Return_value_optimization thayumanavar s -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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.
[algogeeks]
Which kinds of trees are best to use when we have less stack space (to avoid using stack space) (a) AVL Trees (b) Threaded Binary Tree (c) Red and Black Tree (d) Ordered Trees -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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 programe explain
I thnk it shud show error. On Sun, Aug 21, 2011 at 10:50 PM, SuDhir mIsHra sudhir08.mis...@gmail.comwrote: funct(char* str) { printf(%s\n,str); } main() { static int ii = 1; int jj = 5; ii+=++jj; funct(ii+++Campus Interview); } -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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 programe explain
how..??? On Sun, Aug 21, 2011 at 10:53 PM, Sanjay Rajpal srn...@gmail.com wrote: the o/p wil be Interview. Sanju :) On Sun, Aug 21, 2011 at 10:20 AM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: funct(char* str) { printf(%s\n,str); } main() { static int ii = 1; int jj = 5; ii+=++jj; funct(ii+++Campus Interview); } -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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 programe explain
We are converting const char* into char * here On Sun, Aug 21, 2011 at 10:55 PM, Puneet Chawla puneetchawla...@gmail.comwrote: how..??? On Sun, Aug 21, 2011 at 10:53 PM, Sanjay Rajpal srn...@gmail.com wrote: the o/p wil be Interview. Sanju :) On Sun, Aug 21, 2011 at 10:20 AM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: funct(char* str) { printf(%s\n,str); } main() { static int ii = 1; int jj = 5; ii+=++jj; funct(ii+++Campus Interview); } -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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 programe explain
okk tht i knew bt my point is We are converting const char* into char * here means Interview const char* into char * On Sun, Aug 21, 2011 at 10:55 PM, Sanjay Rajpal srn...@gmail.com wrote: See precedence of ++ is greater than that of +=. so ii=7. Now in the statement funct(ii+++Campus Interview), when +++ will be parsed, it'll be ++ +, so ii++ + Campus Interview will be 7 + Campus Interview , which is equivalent to Campus Interview[7]. Now to the function address passed starts from Interview. hence the result. Sanju :) On Sun, Aug 21, 2011 at 10:23 AM, Sanjay Rajpal srn...@gmail.com wrote: the o/p wil be Interview. Sanju :) On Sun, Aug 21, 2011 at 10:20 AM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: funct(char* str) { printf(%s\n,str); } main() { static int ii = 1; int jj = 5; ii+=++jj; funct(ii+++Campus Interview); } -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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 programe explain
ohh srry.i didn't run it...sry again.. On Sun, Aug 21, 2011 at 10:58 PM, Sanjay Rajpal srn...@gmail.com wrote: it is a warning dear, not an error :) Sanju :) On Sun, Aug 21, 2011 at 10:27 AM, Puneet Chawla puneetchawla...@gmail.com wrote: okk tht i knew bt my point is We are converting const char* into char * here means Interview const char* into char * On Sun, Aug 21, 2011 at 10:55 PM, Sanjay Rajpal srn...@gmail.com wrote: See precedence of ++ is greater than that of +=. so ii=7. Now in the statement funct(ii+++Campus Interview), when +++ will be parsed, it'll be ++ +, so ii++ + Campus Interview will be 7 + Campus Interview , which is equivalent to Campus Interview[7]. Now to the function address passed starts from Interview. hence the result. Sanju :) On Sun, Aug 21, 2011 at 10:23 AM, Sanjay Rajpal srn...@gmail.comwrote: the o/p wil be Interview. Sanju :) On Sun, Aug 21, 2011 at 10:20 AM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: funct(char* str) { printf(%s\n,str); } main() { static int ii = 1; int jj = 5; ii+=++jj; funct(ii+++Campus Interview); } -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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] question to code
Here by just applying merge on these array as they are sorted and calculate the middle element..Am i rt..??? On Sun, Aug 21, 2011 at 10:59 PM, vaibhav shukla vaibhav200...@gmail.comwrote: given three sorted arrays not necessary of same length (length is given) we have to determine the middle element such that the element will be the middle one of the such an array which will be formed if all three given arrays are merged in sorted order. input :- arr1 : 1,3,5,7 arr2 : 6,9,12,15,18 arr3 : 2,4,14,20 output : 7 , as if we merge the arrays in sorted order then 7 will be the middle element of that merged array. note : if merged array is of even length then there will be two middle element. ALSO YOU CANNOT USE EXTRA MEMORY. -- best wishes!! Vaibhav -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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] question to code
ohh sryy i didn't read tht On Sun, Aug 21, 2011 at 11:09 PM, vaibhav shukla vaibhav200...@gmail.comwrote: @puneet : but u cant use extra memory On Sun, Aug 21, 2011 at 11:08 PM, Sanjay Rajpal srn...@gmail.com wrote: Take three pointers to the beginning of each array say i,j,k. Now let sum = len a +len b + len c. k=0 now start from the beginning, compare elements at indexes i,j,k. which ever is smaller, increment that index and k, continue till k becomes sum/2. when k becomes sum/2, this element will be middle element of the merged array. I think it could also be done in O(log m + log n + log p), where m, n,p are lengths of the arrays. Correct me if m wrong :) Sanju :) On Sun, Aug 21, 2011 at 10:34 AM, Puneet Chawla puneetchawla...@gmail.com wrote: Here by just applying merge on these array as they are sorted and calculate the middle element..Am i rt..??? On Sun, Aug 21, 2011 at 10:59 PM, vaibhav shukla vaibhav200...@gmail.com wrote: given three sorted arrays not necessary of same length (length is given) we have to determine the middle element such that the element will be the middle one of the such an array which will be formed if all three given arrays are merged in sorted order. input :- arr1 : 1,3,5,7 arr2 : 6,9,12,15,18 arr3 : 2,4,14,20 output : 7 , as if we merge the arrays in sorted order then 7 will be the middle element of that merged array. note : if merged array is of even length then there will be two middle element. ALSO YOU CANNOT USE EXTRA MEMORY. -- best wishes!! Vaibhav -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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. -- best wishes!! Vaibhav MCA -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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 programe explain
@Naman :In codeblocks it's o/p is Interviewi exactly thought the same way but now i think that it depends upon compiler to compiler i don't know the reason behind it. On Sun, Aug 21, 2011 at 11:10 PM, Sanjay Rajpal srn...@gmail.com wrote: but in the question, it is const char * to char *. Sanju :) On Sun, Aug 21, 2011 at 10:38 AM, Naman Mahor naman.ma...@gmail.comwrote: const char* into char * is error not warning i hv run it on DEV c++; On Sun, Aug 21, 2011 at 11:01 PM, Sanjay Rajpal srn...@gmail.com wrote: i didnt run it, this concept is given in J.K.Chhabra book. Sanju :) On Sun, Aug 21, 2011 at 10:29 AM, Puneet Chawla puneetchawla...@gmail.com wrote: ohh srry.i didn't run it...sry again.. On Sun, Aug 21, 2011 at 10:58 PM, Sanjay Rajpal srn...@gmail.comwrote: it is a warning dear, not an error :) Sanju :) On Sun, Aug 21, 2011 at 10:27 AM, Puneet Chawla puneetchawla...@gmail.com wrote: okk tht i knew bt my point is We are converting const char* into char * here means Interview const char* into char * On Sun, Aug 21, 2011 at 10:55 PM, Sanjay Rajpal srn...@gmail.comwrote: See precedence of ++ is greater than that of +=. so ii=7. Now in the statement funct(ii+++Campus Interview), when +++ will be parsed, it'll be ++ +, so ii++ + Campus Interview will be 7 + Campus Interview , which is equivalent to Campus Interview[7]. Now to the function address passed starts from Interview. hence the result. Sanju :) On Sun, Aug 21, 2011 at 10:23 AM, Sanjay Rajpal srn...@gmail.comwrote: the o/p wil be Interview. Sanju :) On Sun, Aug 21, 2011 at 10:20 AM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: funct(char* str) { printf(%s\n,str); } main() { static int ii = 1; int jj = 5; ii+=++jj; funct(ii+++Campus Interview); } -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- You received this message because you
Re: [algogeeks] question to code
@sanjay why you have compared k with sum/2 is it a general solution..??? On Sun, Aug 21, 2011 at 11:11 PM, vaibhav shukla vaibhav200...@gmail.comwrote: @sanjay : yes this is one approach . just doing this and keeping track of the smaller element and wen k is sum/2, the minimum element of the middle on true. but any other approach apart from this and wat if the total length is even, i.e u have to give two middle elements then On Sun, Aug 21, 2011 at 11:09 PM, vaibhav shukla vaibhav200...@gmail.comwrote: @puneet : but u cant use extra memory On Sun, Aug 21, 2011 at 11:08 PM, Sanjay Rajpal srn...@gmail.com wrote: Take three pointers to the beginning of each array say i,j,k. Now let sum = len a +len b + len c. k=0 now start from the beginning, compare elements at indexes i,j,k. which ever is smaller, increment that index and k, continue till k becomes sum/2. when k becomes sum/2, this element will be middle element of the merged array. I think it could also be done in O(log m + log n + log p), where m, n,p are lengths of the arrays. Correct me if m wrong :) Sanju :) On Sun, Aug 21, 2011 at 10:34 AM, Puneet Chawla puneetchawla...@gmail.com wrote: Here by just applying merge on these array as they are sorted and calculate the middle element..Am i rt..??? On Sun, Aug 21, 2011 at 10:59 PM, vaibhav shukla vaibhav200...@gmail.com wrote: given three sorted arrays not necessary of same length (length is given) we have to determine the middle element such that the element will be the middle one of the such an array which will be formed if all three given arrays are merged in sorted order. input :- arr1 : 1,3,5,7 arr2 : 6,9,12,15,18 arr3 : 2,4,14,20 output : 7 , as if we merge the arrays in sorted order then 7 will be the middle element of that merged array. note : if merged array is of even length then there will be two middle element. ALSO YOU CANNOT USE EXTRA MEMORY. -- best wishes!! Vaibhav -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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. -- best wishes!! Vaibhav MCA -- best wishes!! Vaibhav MCA -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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] Syllogism
Don't think so.. On Sun, Aug 21, 2011 at 12:37 AM, priya ramesh love.for.programm...@gmail.com wrote: yes. -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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] thanx...
congo man...:) On Sun, Aug 21, 2011 at 2:03 AM, Ankur pratik ankurocks...@gmail.comwrote: it was done in 4 rounds written 1. aptitude: containing data interpretation and logical reasoning 2.technical: 20 ques from c/c++ basicaly frm pointers..., 5 ques from OS and 5 ques from ds.. interview 3.technical: question frm c basic and code related to ds 4.HR: simple questions like tell me about urself, ur +ve nd -ve points etc i hope these info may help som1 Regards-- Ankur Pratik NIT Durgapur -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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] Adding Two numbers using bitwise operators only
For subtraction we can use the same add function int add(int a, int b) { while (a) { a = (a b) 1; b = a^b; } return b; } int sub(int a, int b) // add a with b's 2's complement. { return (add(a, add(~b, 1))); } On Sat, Aug 20, 2011 at 11:34 PM, priya ramesh love.for.programm...@gmail.com wrote: +1 sagar! -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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: pls solve ...
In 1st case 5 4 T B L M 1 3 6 2 4 N P 3 7 G A C D F J K 1 9 8 2 So sixth to the left of 12th from rt means 20th element from rt ie 2. for 2nd its obvious for 3rd same as 1st case. 6 3 1 M L B 7 3 P N 4 2 T 4 5 G A C D F J K 1 9 8 2 7 will be o/p On Sat, Aug 20, 2011 at 10:25 PM, Sanjay Rajpal srn...@gmail.com wrote: Could u explain how u did this ? Sanju :) On Sat, Aug 20, 2011 at 9:53 AM, Mehnaaz mehnaazmohiud...@gmail.comwrote: 1)2 2)AF9..A C D F J K 1 9, rest all the options have a gap of 2 elements in them 3)7 On Aug 20, 5:16 pm, Anuj kumar anonymize...@gmail.com wrote: QRead the following letter-number sequence carefully and answer the question given below: 7 3 P N 4 2 6 3 1 M L B T 4 5 G A C D F J K 1 9 8 2 Q.1) If the first fifteen elements of the above sequence is written in the reverse order which of the following elements will be sixth to the left of twelfth element from your right? (1) J (2) 6 (3) 2 (4) 3 (5) None of these Q.2) Four of the following five are alike in a certain way and hence form a group. Which is the one that does not belong to that group? (1) GDK (2) 7N6 (3) B5C (4) AF9 (5) TGD Q.3) If we interchange the first and the seventh elements, the second and the eighth elements and so on upto 2 and B from your left, which of the following will be twelfth to left of eighth element from your right? (1) 6 (2) 7 (3) 2 (4) Data inadequate (5) None of these -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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.
[algogeeks]
#define cube(x) (x)*(x)*(x) main() { int x=3,c; c=cube(++x); printf(%d,c); return 0; } will anyone please tell me why o/p is 150.? -- With regards Puneet Chawla -- 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]
In turbo compiler it's o/p is 216 and in dev it's 150.. Help me out.. On Fri, Aug 12, 2011 at 12:45 AM, sagar pareek sagarpar...@gmail.comwrote: after expansion of macro it will be c=(++x)*(++x)*(++x); now it be solved as c= 5*5*(++x); c=25*6; c=150 On Fri, Aug 12, 2011 at 12:38 AM, Puneet Chawla puneetchawla...@gmail.com wrote: #define cube(x) (x)*(x)*(x) main() { int x=3,c; c=cube(++x); printf(%d,c); return 0; } will anyone please tell me why o/p is 150.? -- With regards Puneet Chawla -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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]
@Aditi i thnk sagar parteek is right ...in turbo compiler it's incrementing and finally max of all values and multiply the value means pre increment-evaluate-postincrement On Fri, Aug 12, 2011 at 1:02 AM, sagar pareek sagarpar...@gmail.com wrote: well its always depends on compiler to compiler in turbo c it will first increment all x results in c=6*6*6 c=216 but in gcc it will be as explained by me above On Fri, Aug 12, 2011 at 12:56 AM, aditi garg aditi.garg.6...@gmail.comwrote: i think it wud be undefined...the value is getting modified more than once and hence violating the sequence points rule...plz corect me if im wrong... On Fri, Aug 12, 2011 at 12:48 AM, Puneet Chawla puneetchawla...@gmail.com wrote: In turbo compiler it's o/p is 216 and in dev it's 150.. Help me out.. On Fri, Aug 12, 2011 at 12:45 AM, sagar pareek sagarpar...@gmail.comwrote: after expansion of macro it will be c=(++x)*(++x)*(++x); now it be solved as c= 5*5*(++x); c=25*6; c=150 On Fri, Aug 12, 2011 at 12:38 AM, Puneet Chawla puneetchawla...@gmail.com wrote: #define cube(x) (x)*(x)*(x) main() { int x=3,c; c=cube(++x); printf(%d,c); return 0; } will anyone please tell me why o/p is 150.? -- With regards Puneet Chawla -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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]
In turbo it is showing o/p 2401 again still confused... On Fri, Aug 12, 2011 at 1:14 AM, sagar pareek sagarpar...@gmail.com wrote: ok if we have the scenario like u stated then it will be done in gcc as :- x=3; c=5*5*(++x)*(++x); c=25*6*(++x); c=150*7; c=1050; On Fri, Aug 12, 2011 at 1:10 AM, aditi garg aditi.garg.6...@gmail.comwrote: @sagar: bt i dint understand how is it done what if we had something like (++x)*(++x)*(++x)*(++x) thn how wud it be evaluated in gcc? and since it is giving diff ans on diff compilers that is wat i mean by being undefined... On Fri, Aug 12, 2011 at 1:05 AM, Puneet Chawla puneetchawla...@gmail.com wrote: @Aditi i thnk sagar parteek is right ...in turbo compiler it's incrementing and finally max of all values and multiply the value means pre increment-evaluate-postincrement On Fri, Aug 12, 2011 at 1:02 AM, sagar pareek sagarpar...@gmail.comwrote: well its always depends on compiler to compiler in turbo c it will first increment all x results in c=6*6*6 c=216 but in gcc it will be as explained by me above On Fri, Aug 12, 2011 at 12:56 AM, aditi garg aditi.garg.6...@gmail.com wrote: i think it wud be undefined...the value is getting modified more than once and hence violating the sequence points rule...plz corect me if im wrong... On Fri, Aug 12, 2011 at 12:48 AM, Puneet Chawla puneetchawla...@gmail.com wrote: In turbo compiler it's o/p is 216 and in dev it's 150.. Help me out.. On Fri, Aug 12, 2011 at 12:45 AM, sagar pareek sagarpar...@gmail.com wrote: after expansion of macro it will be c=(++x)*(++x)*(++x); now it be solved as c= 5*5*(++x); c=25*6; c=150 On Fri, Aug 12, 2011 at 12:38 AM, Puneet Chawla puneetchawla...@gmail.com wrote: #define cube(x) (x)*(x)*(x) main() { int x=3,c; c=cube(++x); printf(%d,c); return 0; } will anyone please tell me why o/p is 150.? -- With regards Puneet Chawla -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- 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
Re: [algogeeks] Re: Microsoft written!!!
Agree with mohit goel.. On Wed, Aug 10, 2011 at 11:22 AM, Mohit Goel mohitgoel291...@gmail.comwrote: 10 4 5 2 7 6 11 1 39 8 12 13 14 15 i think we should first find the parent of the particular node ..then apply the concept as told by Brijesh on it p =parent(q); r = parent(p); count =1; while(p ==isright(r)) { p=r; r=parent(r); count++; if(r==root) break; } if(d =right(r)) { while(count!=0) { if(d-left) d=d-left; else d=d-right; count--; } } else return NULL; o/p=d-value; -- 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. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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.