I can appreciate the emphasis on iteration versus recursion, as recursion is not taught to some people.
I don't agree that iteration is always preferable. A recursive algorithm that searches a binary tree is simpler
to understand, requires less book-keeping in variables, and is in general, preferable when explaining to a neophyte.
I think there are an entire class of problems that are similar. --
BenBaker
I'm aware that recursion vs. iteration is one of more controversial of hints listed.
There is certainly class of problems are much easier to solve using recursion than iteration.
That is a hint for problems that can be solved equally easily with both methods (like fibonacci).
There is also a problem that various people find either of methods "simpler to understand".
There's some point in providing both implementations, so both groups can find easy-to-understand algorithm.
Probably some weaker wording should be used. --Taw
Iterative where immediately apparent would be nice. On the other hand, if its a problem that lends itself to recursion, no reason not to. programming is complicated, there's no two ways about it.
BTW, Even with iterative constructs available in LISP, I tend to go recursive just because the language lends itself to it, but in C I go iterative if I can help it. Something to think about... --alan d
I think this page should be renamed "List of Algorithms", should have a one-line explanation of every algorithm, and should be listed on
Reference tables. I don't think it makes much sense to try to dictate in which way people are to write sample implementations. Personally, I'd prefer pseudo code. Also, why is it directed at
Unix programmers? What about
Hurd hackers? --
AxelBoldt
- Page name is almost irrelevant.
- One-line ok
- Reference Tables done
- It's not discating, it's setting standards
- It makes LOT of sense. Bad sample implementation is almost completely useless.
- Pseudo code is really bad idea. It is in no aspect better than real languages like Ruby or Python. It's impossible to test, so may contain errors and one has to assume many things like array indexing about it. Pseudocode should be discouraged.
- It should be directed at Unix programmers, because majority of people interesed in this topic knows Unix or technologies that come from it, like C. No Unix-specific quirks in code of course.
- Objectively speaking, Hurd is kind of Unix or at least mostly Unix-compatible.
- Hurd hackers are very small group of people and I'm sure that all of them know some other Unices.
--
Taw
- Page names involving "Wikipedia" are generally taken to be meta articles about Wikipedia, not genuine Wikipedia articles. If this is intended to be a policy article about Wikipedia coding standards, then there should be a separate list of algorithms.
- While it is true that pseudo code cannot be tested, it is intended for human understanding and may therefore contain less errors. Programming languages often contain obscure constructs (= vs == for instance, or overloaded division /) which make understanding harder. Just because you can test a program doesn't mean that it is less likely to have errors.
- The reference to Hurd was a joke. I was alluding to the fact that there are many programmers which don't use Unix.
The article should be directed at programmers, period. --
AxelBoldt