@Kunal: You are very kind. Dave
On Aug 27, 12:58 pm, Kunal Patil <[email protected]> wrote: > @Dave: Still your approach to solve the problem remains correct. > (subtracting a number from max possible value & then comparing this > difference with another number). So, no need to think that you were brain > dead (If you were, you would have posted a movie story here)..[?] > Mathematically it is wrong, not in terms of approach..[?] > > On Sat, Aug 27, 2011 at 11:02 PM, dipit grover <[email protected]>wrote: > > > > > I think you just need to reverse the comparison operators in Dave's earlier > > post > > > On Sat, Aug 27, 2011 at 10:59 PM, Dave <[email protected]> wrote: > > >> @Abishek: I was brain-dead in my earlier posting. Let me try again: > > >> If either number is zero, the sum will not overflow. > >> If the numbers have different signs, the sum will not overflow. > >> If both numbers are positive, overflow will occur if b > maxint - a. > >> If both numbers are negative, overflow will occur if b < -maxint - a - > >> 1. > > >> Dave > > >> On Aug 27, 12:18 pm, Abhishek <[email protected]> wrote: > >> > @Dave: i didn't understand, > >> > suppose a=30000, b=31000 and MaxInt=32000; > >> > you are saying if (MaxInt-a)>=b; then overflow will occur. but here > >> > condition is not satisfying. > >> > plz explain. > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Algorithm Geeks" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]. > >> For more options, visit this group at > >>http://groups.google.com/group/algogeeks?hl=en. > > > -- > > Dipit Grover > > B.Tech in CSE > > IIT Roorkee > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. > > > > 361.gif > < 1KViewDownload > > 360.gif > < 1KViewDownload- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
