Processing N-node structures.
Take the instance where you hold within a table an instance of a
'document' with a parent and child attribute that links to other documents
(versions).
To cleanly process one document tree using a recursive proc is certainly
the cleanest way. You can write a function to delete a document (which
would ensure the system had any files removed etc.) One call at the top of
the tree could recursively delete all historical instances of a document.
Its all to do with levels of abstraction. Yes you could do this within a
loop, but it would not be clean, and when you get into complex trees and
want to traverse each node, then you are far better off using recursive
procedures... With CF5 this will actually become a reality. CFSCRIPT
finally comes of age!
-----Original Message-----
From: Jeffry Houser [SMTP:[EMAIL PROTECTED]]
Sent: 19 February 2001 05:53
To: CF-Community
Subject: Recursion...
While my mind is currently exploding, I had a thought.
I once had a teacher who said that the only problem where using
recursion was
actually a benefit was the Towers of Hanoi. It's always the problem used
in the
textbooks. He said that he could re-write any recursion algorithm using a
boolean variable and a while loop and it would be more efficient.
So, I'm curious. Has anyone come across a problem where recursion gave a
performance improvement over using a loop?
--
Jeff Houser | mailto:[EMAIL PROTECTED]
AIM: Reboog711 | ICQ: 5246969 | Phone: 860-229-2781
--
Instant ColdFusion 4.5 | ISBN: 0-07-213238-8
Due out 3rd Quarter 2001
--
DotComIt, LLC
database driven web data using ColdFusion, Lotus Notes/Domino
--
Half of the Alternative Folk Duo called Far Cry Fly
http://www.farcryfly.com | http://www.mp3.com/FarCryFly
--
I've got the brains, you've got the looks, let's make lots of money
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists