Re: [algogeeks] Virtual functions in constructor
http://www.parashift.com/c++-faq/virtual-functions.html On Wed, Oct 10, 2012 at 2:16 AM, rahul sharma rahul23111...@gmail.comwrote: Guys i have read that concept of virtual fxn is not applicable in case of constructors..I means using virtual function in constructors always call local function..i wan to read more on this..can nybody explain use of virtual functions in constructor or provide me with a link for this.. thnx -- 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] Min Edges to be added to DAG to make it Strongly connected?
This is the linkhttp://apps.topcoder.com/forums/?module=ThreadthreadID=764182start=0mc=4#1614862to the answer given by misof.. and it worked!! On Sunday, 7 October 2012 00:41:48 UTC+5:30, kailash wrote: @atul: No,it's not the correct answer. Let's take an example of star like DAG:- A --B--C | V D This DAG contains only one cut vertex(B) but we need to add two edges to make it strongly connected. On Sat, Oct 6, 2012 at 7:37 PM, atul anand atul.8...@gmail.comjavascript: wrote: find no. of cut vertex in the DAGthat will be the ans. On 6 Oct 2012 19:33, KK kunalka...@gmail.com javascript: wrote: Given a DAG(Directed Acyclic Graph). How to find out the minimum number of edges that needs to be added so that the given graph becomes Strongly Connected? -- 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/-/PbR3j9S5OXUJ. To post to this group, send email to algo...@googlegroups.comjavascript: . To unsubscribe from this group, send email to algogeeks+...@googlegroups.com javascript:. 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 algo...@googlegroups.comjavascript: . To unsubscribe from this group, send email to algogeeks+...@googlegroups.com javascript:. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- -- ‘Kailash Bagaria’ B-tech 4th year Computer Science Engineering Indian Institute of Technology, Roorkee Roorkee, India (247667) -- 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/-/O5kS0uhrsr4J. 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] Re: Help me find my Recursive algo complexity
Hi Vicky.. Its O(n^K) as u are iterating over all the elements of array for each of the k element subset!! On Monday, 8 October 2012 23:53:15 UTC+5:30, ((** VICKY **)) wrote: Hi, I wrote code for generating all possible sets of length k in a array of length n. I did using recursion, but i'm not able to calc the complexity systematically [image: :-/] Kindly help me. 11:39 PM i.p {1,2,3,4,5} k =2 o.p Vector has : 1 2 3 4 5 1 1 2 2 1 3 3 1 4 4 1 5 5 2 3 6 2 4 7 2 5 8 3 4 9 3 5 10 4 5 Approach: Assume I have a selected and remaining set, now initially all will be remaining set and selected set= {}. In first step pick 1 and grow recursion with it as root and pick 2,3,4,5 (n-1) as possible picks. Now print those sets since k=2(base case) is reached. Now grow recursion with 2 as root and 3,4,5 (n-2) as possible picks(childs) print them. Repeat till i reach 5 where i have no children possible as rem set is empty. void print_all(vectorintsel,vectorintrem, int n){ if(sel.size() == n) { static int cnt = 1; coutcnt++ ; for(int i = 0; i n; i++) coutsel[i] ; coutendl; return; sel.erase(sel.begin(),sel.end()); } for(int i = 0; i rem.size(); i++) { vectorintnow,curr_sel; //for(int j = 0; j i; j++) // now.push_back(rem[j]); for(int j = i+1; jrem.size(); j++) now.push_back(rem[j]); // coutnow has : ; //for(int i = 0; i now.size(); i++) // coutnow[i] ; //coutendl; for(int i = 0; i sel.size(); i++) curr_sel.push_back(sel[i]); curr_sel.push_back(rem[i]); print_all(curr_sel,now,n); }} -- Cheers, Vicky -- 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/-/GTlxcHY8JDYJ. 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] Virtual functions in constructor
FYI .. http://www.artima.com/cppsource/nevercall.html If you read the VTABLE and and how virtual function is implemented then you understand automatically why virtual is not applicable in constructor case . One more request its algo-group please try to avoid out of the topic questions . Thanks Kumar Vishal On Wed, Oct 10, 2012 at 2:16 AM, rahul sharma rahul23111...@gmail.comwrote: Guys i have read that concept of virtual fxn is not applicable in case of constructors..I means using virtual function in constructors always call local function..i wan to read more on this..can nybody explain use of virtual functions in constructor or provide me with a link for this.. thnx -- 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 Kumar Vishal _ *http://wethecommonpeople.wordpress.com/ * *h**ttp://kumartechnicalarticles.wordpress.com/http://kumartechnicalarticles.wordpress.com/ * _ -- 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] this pointer help c++
but i have read that reference is a const pointer That is NOT true. A reference is not a const pointer. Period. It's only because they 'point' to an object and cannot be changed to 'point' to some other object, people say its' a const pointer which is not entirely true. References never 'point' to anything. Reference is an *abstract concept*. an* alias *or a* 'different name for same object'*. A compiler may choose to implement it using a pointer or may not, it depends on compiler. What is size of reference. Had they been simple const pointers you'd get 4-Bytes(on 32 bit architecture) or 8-Bytes (on 64 bit architectures). But what you'll actually get is *size of the object* itself. In fact ISO C++ standard itself says that whether or not a reference requires a storage is unspecified. i.e. It is compiler dependent how they are implemented internally. But Internal implementation mechanisms will never alter the visible behavior which is mandated by the Standard so, what sizeof(reference) will return will always be size of Object itself. what is return by reference?? It is nothing different than a reference initialization for all practical purposes. Let func be a function of class Circle: *Circle Func(double r){* * //Do something...* * return *this;* *}* * * and, you call this function like: (This is how your *return by reference*get's consumed. *Circle ref = Func(7.5);* // { As we know reference initialization is done with object and not by pointers to those objects so, *rvalue should be an Object* of class Circle NOT a pointer.} does it mean some pointer returned or it mean whole object returned?? The whole object is to be passed to the *'reference initialization' mechanism* of the compiler. So you've to return an object itself(that's why make sure you are returning some object that will persist after the function call and not an object which will get destroyed with stack unwinding of Func call. Please don't say references are nothing but const pointers, just throw that notion out of your head. Points to gather: *1. On the surface you can assume: References are just 'different names for same object'. * *2. While initializing them I need to pass the whole Object to the reference initialization mechanism(which btw, is compiler dependent).* *3. Sizeof(reference) is always the sizeof Object itself. (mandated by C++ standard)* *4. Do references require extra storage? Maybe or maybe not. Read your compiler docs.* On 10 October 2012 02:30, rahul sharma rahul23111...@gmail.com wrote: Clear some more questiosn 1. What is size of reference. 2.what is return by reference???it means we return the object itself instead of copying it into temp. variable and then return as in c. in c++ we return original variable itself..then when we return by reference wat does that mean,,,does it mean some pointer returned or it mean whole object returned?? On Wed, Oct 10, 2012 at 2:23 AM, rahul sharma rahul23111...@gmail.comwrote: Got confusedcant get it..:([?] On Wed, Oct 10, 2012 at 1:00 AM, Prem Krishna Chettri hprem...@gmail.com wrote: Well Lemme try few more hand here.. Basics First Guys :- this :- is a hidden pointer to a class (Agree ?). So whats so special about it.. Answer is its compaction when the object of the class is being created. Why? Here it goes. As object memory allocation (I hope everyone knows) have memory structure such that the first parameter always starts with arg[1]. so why not arg[0] as array always indexes with 0? The Answer is here.. Coz every time the object of a class is generated the Zeroth index is alwayz occupied by this *this* pointer. So if do you follow me up to here properly that you know the significance of this now.. Coz its object refference lies to the value of offset 0 to the base address of the class's object, giving the flexibility to express any member of the class by directly accessing via its base address and this also explains why this has to be a pointer and not a normal member variable. Now here comes the other part of question.why we need * ** *this* where *this* should give the base address of the object of the class we wanna refer. The Answer is partly YES coz as we discuss *this *knows almost everything about the class or rather an object of a class within a class scope but here is the catch we are telling someone to get a bowl of rice from my private house. So how will he be able to get it? Until I tell him my house structure, which in programming language like C++ is reference. I am saying sir, I have created a house (object) and here is the layout (referring to what I have created) so inorder to tell him about my layout I have to generate the return value which is NOT the house (object) but the reference to the house ( pointer pointing to what I have created ). Now I am almost done here.. So Why ** this * and not *this * is coz *this* gives the
Re: [algogeeks] Virtual functions in constructor
In short: Call for virtual function in constructor is redirected to the local function because, the derived part of the object has not being initialized yet(remember you are still in Bases' constructor) and it makes no sense to call a derived's implementation of a virtual function, which in turn be using some (still uninitialized) non-static data members of derived class. You can read it in detail over here: http://www.parashift.com/c%2B%2B-faq-lite/calling-virtuals-from-ctors.html Also i recommend - *Inside the C++ Object Model* By Stanley B. Lippman. Cheers, On 10 October 2012 02:16, rahul sharma rahul23111...@gmail.com wrote: Guys i have read that concept of virtual fxn is not applicable in case of constructors..I means using virtual function in constructors always call local function..i wan to read more on this..can nybody explain use of virtual functions in constructor or provide me with a link for this.. thnx -- 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] Min Edges to be added to DAG to make it Strongly connected?
i have doubts in miscof answer , your question says that given graph is a DAG ,but in miscof's reply he is considering directed graph which contain say n strongly connected component , so if we consider dat there are n strongly connected component in your graph then that graph is not a DAG(this will violates your question). But if you are considering all nodes in a given strongly connected graph as a single node then given graph will form DAG. so there is lot of difference in the twoso please clarify your question. On Wed, Oct 10, 2012 at 1:26 AM, KK kunalkapadi...@gmail.com wrote: This is the linkhttp://apps.topcoder.com/forums/?module=ThreadthreadID=764182start=0mc=4#1614862to the answer given by misof.. and it worked!! On Sunday, 7 October 2012 00:41:48 UTC+5:30, kailash wrote: @atul: No,it's not the correct answer. Let's take an example of star like DAG:- A --B--C | V D This DAG contains only one cut vertex(B) but we need to add two edges to make it strongly connected. On Sat, Oct 6, 2012 at 7:37 PM, atul anand atul.8...@gmail.com wrote: find no. of cut vertex in the DAGthat will be the ans. On 6 Oct 2012 19:33, KK kunalka...@gmail.com wrote: Given a DAG(Directed Acyclic Graph). How to find out the minimum number of edges that needs to be added so that the given graph becomes Strongly Connected? -- 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/-/PbR3j9S5OXUJhttps://groups.google.com/d/msg/algogeeks/-/PbR3j9S5OXUJ . To post to this group, send email to algo...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+...@** googlegroups.com. For more options, visit this group at http://groups.google.com/** group/algogeeks?hl=en 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 algo...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+...@** googlegroups.com. For more options, visit this group at http://groups.google.com/** group/algogeeks?hl=en http://groups.google.com/group/algogeeks?hl=en. -- -- ‘Kailash Bagaria’ B-tech 4th year Computer Science Engineering Indian Institute of Technology, Roorkee Roorkee, India (247667) -- 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/-/O5kS0uhrsr4J. 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.
[algogeeks] can we check a number has last digit 5 or not using bitwise operator.
-- 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] rectangle of max sum MS Q
@atul.ok i got it thanx a lot On Tue, Oct 9, 2012 at 10:08 AM, atul anand atul.87fri...@gmail.com wrote: @priya : i dont knw , how you came up with these values ...!!! and aove code given is not a full code , it just a sketch of code to make you understand.Before moving further,i would like to clarify that innner K-loop is running kadane algo(full code is not written). so i cut short in this by discussing the idea behind it After finding cumulative sum of each column ..moving top to bottom , Suppose we get this :- 1 0 0 0 1 1 1 -2 1 2 2 -4 2 3 2 -3 now IDEA is start from last row. -- ( I-Loop is handling this ) negate values i each cell of first row from the each cell for last row -- ( j-Loop is handling this ) i.e 2-1 , 3-0 , 2-0, -3-0 == 1,3,2,-3 1,3,2,-3 == now run kadane algo on this last row only and update max ( K-loop is doing this) similarly , when we increment j i.e now we move to second row which j loop is handling. do the same :- 2-1,3-1, 2-1,-3-2 // --- run kadane algo on this and update max. now when j loop ends , then we are moving to second last row and doing the same ...as we did with last row in above example. i hope now you get it.. On 10/9/12, Priya Dhingra priya.dhingr...@gmail.com wrote: i dnt know how ur algo is handling the case like [c2 d2 ,c3 d3] or [c1 d1, c2 d2 ,c3 d3] as i run this loop it is considering the following matrices i=3 j=0 nd k=0 to 3 [a2 a3 a4],[a2 b2,a3 b3,a4 b4].[a2 b2 c2,a3 b3 c3,a4 b4 c4],[a2 b2 c2 d2 ,a3 b3 c3 d3,a4 b4 c4 d4] i=3 j=1 nd k=0 to 3 [a3 a4], [a3 b3, a4 b4],[a3 b3 c3, a4 b4 c4 d4],[a3 b3 c3 d3 ,a4 b4 c4 d4] i=3 j=2 k =0 to 3 [a4] [a4 b4] [a4 b4 c4] [a4 b4 c4 d4] i=2 j=0 k=0 to 3 [a2 a3] [a2 b2,a3 b3],[a2 b2 c2,a3 b3 c3],[a2 b2 c2 d2 ,a3 b3 c3 d3] i=2 j=1 k=0 to 3 [a2] [a3 b3] [a3 b3 c3] [a3 b3 c3 d3] i=1 j= k =0 to 3 [a2] [a2 b2] [a2 b2 c2][a2 b2 c2 d2] On Mon, Oct 8, 2012 at 9:53 PM, atul anand atul.87fri...@gmail.com wrote: @Priya : if first row is the max one , then it is actually boundary case which you can be handled easily,once you are done which above algo. please note that only first row need to checked if it max not every row , above algo is handling this . you can also modify given algo which will handle this boundary case. for rest of the cases it will work fine. It is handling cases like... c2d2 c3d3 etc... please try to understand idea behind the given algo ,let me know in case you have any further doubt. On Mon, Oct 8, 2012 at 10:52 PM, Priya Dhingra priya.dhingr...@gmail.comwrote: @atul if the largest matrix is [a1 b1 c1 d1 ] i mean if it is the first row or if it is [c2 d2.i think then then ur code wont be giving the right answer. c3 d3] correct me if i'm wrong On Monday, January 16, 2012 7:51:46 AM UTC-8, atul007 wrote: find cumulative sum of each column. now for each arr[x][y] = sum of arr[i=0 to x] [j] ; a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 a4 d4 c4 d4 now we have reduced this problem to find max-subarray . which can be efficiently calculated using kadane's algo for each row. NOTE: now suppose if row = 0 does not participate in calculating max sum matrix so u need to subtract a1 from a2,a3,a4 similarly for other element in row 1,2,3. now updated matrix considered i.e from (row =1 to row =3 ). for this updated matrix, each[x][y] is the sum of arr[i=1 to x] [j]. similarly do for other elements. On Mon, Jan 16, 2012 at 6:55 AM, Ashish Goel ash...@gmail.com wrote: given a m*n matrix, find the subset rectangle with max sum (any other rectangle taken would have lesser sum) Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algo...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+...@** googlegroups.com. For more options, visit this group at http://groups.google.com/** group/algogeeks?hl=en http://groups.google.com/group/algogeeks?hl=en. -- 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/-/4jFUDHYfBqUJ. 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.
Re: [algogeeks] this pointer help c++
thnx a lot On Wed, Oct 10, 2012 at 9:27 AM, Saurabh Kumar srbh.ku...@gmail.com wrote: but i have read that reference is a const pointer That is NOT true. A reference is not a const pointer. Period. It's only because they 'point' to an object and cannot be changed to 'point' to some other object, people say its' a const pointer which is not entirely true. References never 'point' to anything. Reference is an *abstract concept*. an* alias *or a* 'different name for same object'*. A compiler may choose to implement it using a pointer or may not, it depends on compiler. What is size of reference. Had they been simple const pointers you'd get 4-Bytes(on 32 bit architecture) or 8-Bytes (on 64 bit architectures). But what you'll actually get is *size of the object* itself. In fact ISO C++ standard itself says that whether or not a reference requires a storage is unspecified. i.e. It is compiler dependent how they are implemented internally. But Internal implementation mechanisms will never alter the visible behavior which is mandated by the Standard so, what sizeof(reference) will return will always be size of Object itself. what is return by reference?? It is nothing different than a reference initialization for all practical purposes. Let func be a function of class Circle: *Circle Func(double r){* * //Do something...* * return *this;* *}* * * and, you call this function like: (This is how your *return by reference*get's consumed. *Circle ref = Func(7.5);* // { As we know reference initialization is done with object and not by pointers to those objects so, *rvalue should be an Object* of class Circle NOT a pointer.} does it mean some pointer returned or it mean whole object returned?? The whole object is to be passed to the *'reference initialization' mechanism* of the compiler. So you've to return an object itself(that's why make sure you are returning some object that will persist after the function call and not an object which will get destroyed with stack unwinding of Func call. Please don't say references are nothing but const pointers, just throw that notion out of your head. Points to gather: *1. On the surface you can assume: References are just 'different names for same object'. * *2. While initializing them I need to pass the whole Object to the reference initialization mechanism(which btw, is compiler dependent).* *3. Sizeof(reference) is always the sizeof Object itself. (mandated by C++ standard)* *4. Do references require extra storage? Maybe or maybe not. Read your compiler docs.* On 10 October 2012 02:30, rahul sharma rahul23111...@gmail.com wrote: Clear some more questiosn 1. What is size of reference. 2.what is return by reference???it means we return the object itself instead of copying it into temp. variable and then return as in c. in c++ we return original variable itself..then when we return by reference wat does that mean,,,does it mean some pointer returned or it mean whole object returned?? On Wed, Oct 10, 2012 at 2:23 AM, rahul sharma rahul23111...@gmail.comwrote: Got confusedcant get it..:([?] On Wed, Oct 10, 2012 at 1:00 AM, Prem Krishna Chettri hprem...@gmail.com wrote: Well Lemme try few more hand here.. Basics First Guys :- this :- is a hidden pointer to a class (Agree ?). So whats so special about it.. Answer is its compaction when the object of the class is being created. Why? Here it goes. As object memory allocation (I hope everyone knows) have memory structure such that the first parameter always starts with arg[1]. so why not arg[0] as array always indexes with 0? The Answer is here.. Coz every time the object of a class is generated the Zeroth index is alwayz occupied by this *this* pointer. So if do you follow me up to here properly that you know the significance of this now.. Coz its object refference lies to the value of offset 0 to the base address of the class's object, giving the flexibility to express any member of the class by directly accessing via its base address and this also explains why this has to be a pointer and not a normal member variable. Now here comes the other part of question.why we need * ** *this* where *this* should give the base address of the object of the class we wanna refer. The Answer is partly YES coz as we discuss *this *knows almost everything about the class or rather an object of a class within a class scope but here is the catch we are telling someone to get a bowl of rice from my private house. So how will he be able to get it? Until I tell him my house structure, which in programming language like C++ is reference. I am saying sir, I have created a house (object) and here is the layout (referring to what I have created) so inorder to tell him about my layout I have to generate the return value which is NOT the house (object) but the reference to the house ( pointer
Re: [algogeeks] Virtual functions in constructor
@vishal...i know its algo group..i was not getting exact answer..so posted...hope it will also help someone. On Wed, Oct 10, 2012 at 9:53 AM, Saurabh Kumar srbh.ku...@gmail.com wrote: In short: Call for virtual function in constructor is redirected to the local function because, the derived part of the object has not being initialized yet(remember you are still in Bases' constructor) and it makes no sense to call a derived's implementation of a virtual function, which in turn be using some (still uninitialized) non-static data members of derived class. You can read it in detail over here: http://www.parashift.com/c%2B%2B-faq-lite/calling-virtuals-from-ctors.html Also i recommend - *Inside the C++ Object Model* By Stanley B. Lippman. Cheers, On 10 October 2012 02:16, rahul sharma rahul23111...@gmail.com wrote: Guys i have read that concept of virtual fxn is not applicable in case of constructors..I means using virtual function in constructors always call local function..i wan to read more on this..can nybody explain use of virtual functions in constructor or provide me with a link for this.. thnx -- 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.
[algogeeks] Re: can we check a number has last digit 5 or not using bitwise operator.
@Mohit: The decimal representation of a number ends in 5 if its low order bit is 1 and it is divisibile by 5. An algorithm using bitwise operations to check for divisibility by 5 is given at https://groups.google.com/d/msg/algogeeks/I5HWmwKW_ks/n38FWJSd0l8J. It probably is not as fast as (n 1) (n % 5 == 0), though. Dave On Wednesday, October 10, 2012 4:06:28 AM UTC-5, mohit mishra wrote: -- 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/-/bRupe9F1MUIJ. 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.