Re: using a for loop to determine maximum value of an int variable
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Wed, 6 Dec 2006 17:28:44 -0800
"Bill Butler" <qwerty@xxxxxxxx> wrote in message
news:tYJdh.114$qh.5@xxxxxxxxxxx
[...]
All good points
Perhaps I should have spent more than 5 minutes on it :^)
I was simply attempting to point out how to improve on O(N) performance
Well, I hope you're not taking it too hard. After all, applying the
unbounded binary search technique the problem seems reasonable, if you want
to completely abstract it. :) Just getting the basic algorithm out there
is the key thing, even if it could use a little massaging after the fact.
And I think you're being way too conservative on your algorithm order
analysis. IMHO, since the element of the data that alters the length of the
algorithm is the number of bits in the variable (rather than the maximum
value per se), I think that the order is actually exponential -- O(2^N) --
rather than linear. So your binary search is clearly even *more* of an
improvement than you seem to think.
Still, hopefully we can all agree that using a built-in constant is really
the fastest, most appropriate solution. :)
Pete
.
- References:
- using a for loop to determine maximum value of an int variable
- From: garyusenet
- Re: using a for loop to determine maximum value of an int variable
- From: per9000
- Re: using a for loop to determine maximum value of an int variable
- From: garyusenet
- Re: using a for loop to determine maximum value of an int variable
- From: garyusenet
- Re: using a for loop to determine maximum value of an int variable
- From: Peter Duniho
- Re: using a for loop to determine maximum value of an int variable
- From: Bill Butler
- using a for loop to determine maximum value of an int variable
- Prev by Date: Re: using a for loop to determine maximum value of an int variable
- Next by Date: Re: Is Class Synonymous with Type?
- Previous by thread: Re: using a for loop to determine maximum value of an int variable
- Next by thread: Re: using a for loop to determine maximum value of an int variable
- Index(es):
Relevant Pages
|