quote: Original post by bpj1138
I don''t see what you mean by "use data structures to compute the cost". It seems redundant to me, because you already have the node/link structure, and what other structure can be more efficient or more intuitive or more suitable?
You are using a horrendously computationally intensive recursion. In doing so, you may very likely evaluate positions multiple times, when nothing in them has changed.
A clever data structure will prevent unnecessary evaluations.
quote:
Which brings me to another point, you said my implmentation is "naive". I take that as a compliment, because I strive to make my code as simple as possible, even if it sacrifices some efficiency. Code clarity is number one concern.
--bart
Bubble sort is more clear than quicksort. Does that mean that bubble sort is a "better" sort, due to the fact that it can be more easily understood?
I said it was naive because you implied that you would recursively evaluate costs of every individual node. Not only is it still unclear how you plan to do this, but even doing so is horribly inefficient.
Naive does not refer to the readablility of the code. A very complex algorithm can be written with very clear code, and a naive algorithm could be written horrendously.
Actual coding is just a routine excercise.
Algorithm development is much more important as a science.