Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: Eliminating Recursive Tree Walking by using MJD-style Infinite Streams?

by ikegami (Patriarch)
on Jun 17, 2008 at 14:50 UTC ( [id://692529]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Eliminating Recursive Tree Walking by using MJD-style Infinite Streams?
in thread Eliminating Recursive Tree Walking by using MJD-style Infinite Streams?

In case you're curious,

only requires as many nodes on the stack as the max depth of the tree.

So does mine below.

It does this by creating an iterator (one item) for the stack instead of a list of nodes (many) to visit.

Mine doesn't wrap the array index in an iterator. I started making a version that did, but it was complicating the ability to return the path that led to the node (like the OP's) instead of just the node (like yours).

  • Comment on Re^4: Eliminating Recursive Tree Walking by using MJD-style Infinite Streams?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://692529]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found