Re: math help
| From: | Dean Hall | Date: | Fri, 25 Aug 2000 22:53:30 +0000 |
| Subject: | Re: math help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13752@lists.php.net to get a copy of this message | ||
> Ahh.. well i didn't know that. I was always taught that using recusive
> calls was (for the most part) faster than using a big loop (you know all
> that Big O notation stuff that I learned in school a couple of years ago).
> But thanks for the info!
>
> Jay
Recursive calls use more system resources than loops by default, and that
fact would not factor into its complexity (Big O). Complexity is limited to
telling you how many "operations" an algorithm executes (kinda). Recursion
in some instances, depending on the data structure and the algorithm is
faster than its iterative counterpart, but most people don't know how to
write recursion correctly, so there is always the issue of infinite
recursion if your base case is not complete.
Recursion is definitely easier to code if you understand it, but there is
usually a tradeoff between ease-of-coding and time.
Dean.