I just answered this question
How can I randomly generate trees?
and then part of me wanted to close it since it seems more like an on topic question for a SO but not here. Thoughts?
I think ones like this are fine: that is, it wasn't asking about implementation. Algorithms of the sort referenced are needed all the time in random graphs, etc. If it was asking about data structures, I'd probably feel differently...
I'm also in favor of allowing algorithm questions, at least the mathematical side of things. The OP's question in particular seems entirely fine to me. This wasn't something about specific languages or implementation (which would belong on SO) but simply the pure method of approach: that's a mathematical problem. Cf. also the thread on whether theoretical computer science is acceptable here.
I'd say the kind of algorithm question Knuth is interested in are acceptable, and that gives us something like a criterion for here. Suggestion — the following two kinds of algorithm question
- What algorithm solves a problem we all know to be mathematical? E.g., finding primes.
- Algorithms whose generality makes them interesting. E.g., finding smallest cut sets for graphs.
Beyond that, we should, I think, be open to people who are trying to fins algorithms that don't meet these criteria, but where the askers can show that they have run into mathematical problems.
I doubt this is going to be much of an issue for this site, since no-one is going to come here to ask for help with their programming question, when SO is so much more useful for that kind of thing. Unless we are seen to be a soft touch with homework questions...
While the study of algorithms has a mathematical component, and thus some questions about algorithms are on-topic on this site (e.g. correctness, complexity), the topic is better covered on a site that also covers the applied side, such as correctness assurance, ease of implementation and concrete efficiency concerns (e.g. cache friendliness). Computer Science welcomes all questions on theoretical and applied computer science, including questions about algorithms (but excluding questions about implementation problems, i.e. coding, which belong on Stack Overflow).