Re: Finding if a number is in the range
| From: | Christian Reiniger | Date: | Fri, 18 May 2001 08:47:42 +0000 |
| Subject: | Re: Finding if a number is in the range | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-53388@lists.php.net to get a copy of this message | ||
On Friday 18 May 2001 06:16, MaD dUCK wrote:
> also sprach Zak Greant (on Thu, 17 May 2001 09:35:18PM -0600):
> > Or just use a simple chain of if statements :)
>
> yeah, but that's so O(n) !
> i can do in O(lg n)
> or, given n CREW processors, in O(1) time!
>
> yes, i have just finished my computational theory and computer
> algorithms honors exam.
Well, then you *do* know that O(log n) can be slower than O(n), right? :)
For a small number of ranges the chained ifs are most likely faster...
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
(A)bort (R)etry (P)retend this never happened ...