Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^4: Improve My FaceBook Scramble Solver

by Limbic~Region (Chancellor)
on Aug 18, 2009 at 20:03 UTC ( #789578=note: print w/replies, xml ) Need Help??

in reply to Re^3: Improve My FaceBook Scramble Solver
in thread Improve My FaceBook Scramble Solver

I'm puzzled by your comment that DFS iteratively is ugly.

Which was made in reference to my comment "I have done a DFS iteratively and it is ugly." That should probably have been two distinct statements. "What I have done is a DFS." and "I think it is ugly compared to the recursive alternatives". In my opinion, the situation is reversed in a BFS (recursive being the ugly one). I go on to indicate that my motivation was producing results rather than maintainable code. Perhaps it is just personal aesthetics but I don't find while (@work) { ... } very beautiful. It is just more natural to me.

I'd also recommend that you put some work pushing past your recursion block.

I agree and have dabbled with it off and on. I don't have any problem understanding other people's recursive routines but producing them myself doesn't seem natural. I recently wrote a recursive sub to find the root node of child in a tree by following the parent all the way to the top. Believe it or not, it was harder for me to write something that simple than it was for me to think about the iterative form. Again, thank you for the feedback and encouragement. I will continue to plug away at it.

Cheers - L~R

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://789578]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2018-04-22 22:21 GMT
Find Nodes?
    Voting Booth?