Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Improve My FaceBook Scramble Solver

by Limbic~Region (Chancellor)
on Aug 18, 2009 at 20:03 UTC ( [id://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

tilly,
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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-19 01:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found