25 messages in org.ibiblio.lists.xom-interest[XOM-interest] Recursion
FromSent OnAttachments
Wolfgang HoschekFeb 9, 2004 6:42 pm 
Elliotte Rusty HaroldFeb 10, 2004 9:25 am 
Wolfgang HoschekFeb 10, 2004 3:23 pm 
jco...@reutershealth.comFeb 10, 2004 3:48 pm 
Elliotte Rusty HaroldFeb 11, 2004 1:21 pm 
Wolfgang HoschekFeb 11, 2004 1:24 pm 
jco...@reutershealth.comFeb 11, 2004 2:15 pm 
Elliotte Rusty HaroldFeb 11, 2004 3:18 pm 
jco...@reutershealth.comFeb 11, 2004 4:20 pm 
Francois BeausoleilFeb 11, 2004 8:08 pm 
Trimmer, ToddFeb 12, 2004 11:57 am 
Elliotte Rusty HaroldFeb 12, 2004 2:53 pm 
Trimmer, ToddFeb 13, 2004 1:26 pm 
Elliotte Rusty HaroldMar 8, 2004 3:17 pm 
jco...@reutershealth.comMar 8, 2004 4:06 pm 
Elliotte Rusty HaroldMar 8, 2004 4:34 pm 
Elliotte Rusty HaroldMar 9, 2004 11:55 am 
Bradley S. HuffmanMar 9, 2004 12:09 pm 
Elliotte Rusty HaroldMar 9, 2004 1:05 pm 
jco...@reutershealth.comMar 9, 2004 2:04 pm 
jco...@reutershealth.comMar 9, 2004 4:32 pm 
Elliotte Rusty HaroldMar 9, 2004 10:43 pm 
John CowanMar 9, 2004 10:58 pm 
Elliotte Rusty HaroldMar 10, 2004 6:12 am 
Dirk BergstromMar 10, 2004 6:25 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[XOM-interest] RecursionActions...
From:Elliotte Rusty Harold (elh@metalab.unc.edu)
Date:Mar 8, 2004 4:34:46 pm
List:org.ibiblio.lists.xom-interest

At 4:06 PM -0500 3/8/04, jco@reutershealth.com wrote:

This does preorder processing (parents before children). Provided there are O(1) ways to find the first child, right sibling, and parent, this is slightly more time-efficient than recursion, and its stack consumption is O(1).

I think I've got it now. That O(1) is a kicker though. At the moment I don't have an O(1) means to find the right sibling. But I think I see an optimization that should make this order 1, given that I'm always iterating forward.

For processing other than from the root node, you eliminate step 0 and change step 4 to "If the current node is not the initial node".

Yes, the first time the code compiled that bug tripped me up. Fortunately the unit tests caught it, and I was able to fix it.

One thing I'm noticing is there's a lot more recursion in the code, not just in the Serializer and toXML(). For instance, the getValue() and getNamespace(String prefix) methods are recursive. It should be easy enough to remove from getValue(). Removing it from getNamespace() will be trickier. --