Using the traditional visited flag approach, your program will fail if two
threads try to print the same tree structure at the same time.

I personally have found the hash table approach to be very effective.  It
uses space, but the space can be garbage collected as soon as you're
finished with the task.

Another good option is to store a unique numeric id from 0 to n-1 where n is
the number of nodes, in each node of the graph.  Then, you can use a fresh
vector to do the marking (or a primitive boolean array if you need the best
possible space/time performance).

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to