POV-Ray : Newsgroups : povray.off-topic : Teach yourself C++ in 21 days : Re: Days 5- Server Time
29 Jul 2024 10:31:39 EDT (-0400)
  Re: Days 5-  
From: Warp
Date: 28 Apr 2012 04:33:05
Message: <4f9bab41@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> That said, I've found I rarely need it

  It's not usual to need it, but sometimes it can be quite useful.
Almost anything involving things like permutations and combinations
are significantly easier to express recursively than iteratively.

> If you can handle the program crashing when you 
> give it too much data in a way that generates bogus results, then sure, feel 
> free. :-)

  As I said, if the recursion depth is O(log n), then you *can't* give it
so much data as for the stack space to run out. It's physically impossible.

  If your recursion level is O(n), then it sounds a lot like an iterative
algorithm that has been expressed recursively for no good reason. (Of
course exceptions probably exist, but are rare.)

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.