I was very surprised to find that this question had been closed as "off topic":

It seems like a straightforward practical algorithms question, not the kind of thing that should be migrated to cstheory.stackexchange.com. Surely if a topic has a whole volume of The Art of Computer Programming devoted to it, then it's on-topic at Stack Overflow?

This isn't the first closure of a question about algorithms that I've seen recently. I wonder if there are Stack Overflow users who believe that algorithms are some kind of computer sciency thing that don't belong with practical programming problems?

The five users who closed this particular question are highly experienced (hence supposedly respected) members of the site, all with 10k+ reputation: John Saunders has 70k and mark_s 129k. So I don't think this is a mistake made by inexperienced members of the site.

I have no particular suggestion for how to solve this; I'm not sure whether this is a problem to be solved at all, or just a couple of poor closure decisions. I'm just giving a heads-up that users' ideas of what counts as on-topic for the site may be diverging. But maybe you have some ideas?

It's clear from the answers below that this is indeed a problem: there seem to be a number of users of this site who think it's inappropriate to ask questions about algorithms without reference to their implementation in a particular programming language. This seems wrong to me: for a practitioner skilled in the art, it's usually straightforward, once one has found an appropriate algorithm, to implement it in any particular language. So discussing the algorithm in a language-independent context helps to keep attention on the important algorithmic ideas, rather than the particular details of implementation.

Here's another algorithmic question that was closed, this time as "not a real question":

And here's a well-known and important programming problem closed as "off topic":

  • I worry a little about allowing questions that don't have any source code, or even mention a particular programming language. If we allow some algorithm questions, we have to be really careful to draw the line about which ones we're going to allow. And if we allow algorithm questions, why don't we allow other types of mathematics questions? Solving the quadratic formula may not be considered an "algorithm" question to a seasoned programmer, but it might be difficult for a student to tell the difference. We get a lot of these, and usually try to migrate them to Math.SE.
    – Cody Gray
    Jul 8, 2011 at 12:45
  • 3
    I don't think there's any way to tell if the vote was divided among the reason, but I could see that as bordering on NARQ more than being off topic. The user has indicated what they need, but is not very specific on how they got where they are, and they don't indicate that there's any associated code.
    – jonsca
    Jul 8, 2011 at 12:49
  • 1
    It's fair enough to draw the line somewhere: I'm just questioning whether it's being drawn in the right place. And anyway, the sites have different concerns. If someone asked about the quadratic equation here, we would mention practical concerns: the need to check that the discriminant is non-negative, cases where there are problems with accuracy, and whether in some applications you might want to avoid taking square roots by using some kind of approximation. Whereas on the math site, they might explain the generalization to other fields, and the connection to Galois theory. Jul 8, 2011 at 12:50
  • @jonsca: I don't want to defend the question as being particularly great, but it seemed clear to me (allowing for a bit of language difficulty). The questioner indicated that he had tried the standard approaches for computing the power set (e.g. iterating over integers below 2^n and interpreting each as a bitset) and had got the results in an inconvenient order. Posting code would have been pointless (I know what the standard approaches are, I'm not going to re-read his code to find out) as what is needed here is a new algorithmic approach. Jul 8, 2011 at 12:56
  • @Gareth Perhaps the last part can be assumed, but reading the question, I didn't see any of those words. There a lot of questions where users put forth "I searched Google for 37 hours and didn't find anything", and I know the circumstances may be different here, but there was an air of similarity. The OP did diagram his/her problem, I'll give him/her credit for that.
    – jonsca
    Jul 8, 2011 at 12:59
  • @jonsca: Closing for "not showing enough evidence of work" would perhaps have been fair enough (though I think it is reasonable to allow a bit of slack for language difficulties). But the question was closed for being "off topic". Jul 8, 2011 at 13:30
  • @Gareth I agree with you. I was just trying to find a rationale for why voting to close may have started in the first place. It's tough to tell without asking the closers.
    – jonsca
    Jul 8, 2011 at 13:34
  • 1
    @Gareth I've edited the triangle question, and voted to open. If you check the revision you should see a distinct difference between a generic math question, and a programming specific math question. Hopefully you at least see and understand the distinction, even if you don't agree with it.
    – Pollyanna
    Aug 19, 2011 at 20:56
  • I think this question was mistakenly moved at the MSO/MSE split. While it is offtopic here, a better solution would be to fix the work and move it back to the SO (afaik CMs can migrate even >2month old questions.
    – peterh
    Dec 30, 2020 at 19:37

5 Answers 5


At first glance I thought the question you linked to might have been closed because "power set" indicates that it's more of a math question, but reading the entire question makes it pretty clear that it's not the case. I reopened the question.

I'd like to say that over 12,000 questions on Stack Overflow means that they're definitely on topic, but I've seen off-topic tags get more usage. (As a matter of fact, I think the tag once had more usages than that.) Regardless, I think any algorithms question that has even the feeblest of programming connection should be considered on-topic for Stack Overflow. (So questions like "what are the steps to make my bed in the morning?" or even "what are the steps to set up my home wireless router?" would obviously not be allowed.)

  • There seem to be a lot of "gimme [an algorithm]" that slip under the radar, I would hope those could still be considered NARQ.
    – jonsca
    Jul 8, 2011 at 13:24
  • 1
    Thanks, Bill, for re-opening the question. I guess that a bit of domain expertise helps here. If you program in a language which has sets built in, then you naturally start thinking in set-theoretic terms: "I'll solve this by iterating over the power set of the input" or whatever. So mathematical ideas like "power set" become everyday practical concerns. Jul 8, 2011 at 13:25
  • 2
    @jonsca: If they fit the summary criteria for "NARQ" then I'd still go ahead and close them. Jul 8, 2011 at 13:29

From the not-really-one-and-never-read FAQ:

Stack Overflow is for professional and enthusiast programmers, people who write code because they love it. We feel the best Stack Overflow questions have a bit of source code in them, but if your question generally covers …

  • a specific programming problem
  • a software algorithm
  • software tools commonly used by programmers
  • matters that are unique to the programming profession

Please note, a software algorithm != an algorithm. Algorithm questions are acceptable, but only if you ask for an algorithm for use in applications, or couched in the terms of a software language.

  • 3
    Damn it, even I did not check the FAQ. Jul 8, 2011 at 13:21
  • 1
    This seems like a slightly tendentious interpretation of the phrase "software algorithm". It is your opinion, then, that language-agnostic algorithm questions are off-topic? Jul 8, 2011 at 13:22
  • @BilltheLizard: not-really-one-and-never-read
    – user1228
    Jul 8, 2011 at 13:23
  • 1
    @GarethRees: Language-agnostic is fine. But, again, it has to be a "software algorithm." If you cannot demonstrate, whether on its face or by some explanation, that the algorithm is software related, it is going to get closed. StackOverflow is about programming and stuff, yaknow.
    – user1228
    Jul 8, 2011 at 13:25
  • I agree that if you cannot demonstrate a connection to software, it's certainly off topic. The line has to be drawn somewhere. But is it right to draw it here? Do you think the particular question was off topic in this case? Jul 8, 2011 at 13:28
  • @GarethRees: I believe it was right. I don't see how that question is programming related.
    – user1228
    Jul 8, 2011 at 13:42
  • Really? Even when you've seen three people give answers that all interpret it as being programming related? Jul 8, 2011 at 14:09
  • 1
    @GarethRees: Yes, really. You can ask a question about growing daisies and I can answer it providing details about how I would implement a watering system using the .NET pico framework and a particular netduino board, but that still doesn't change the fact that the quesiton is off topic.
    – user1228
    Jul 8, 2011 at 14:20
  • OK, I understand. So if I want to ensure that you won't close a question like this as off-topic, I just need to edit it and add the question, "How can I write a program to do this?" Is that right? Jul 8, 2011 at 14:23
  • @GarethRees: Yep. Just give some justification why its on StackOverflow. That's all most anyone would ask.
    – user1228
    Jul 8, 2011 at 14:24
  • 1
    -1: I don't believe the distinction between algorithm and software algorithm is remotely tenable. Jul 19, 2011 at 19:13
  • @DerrickTurk: Tell me, how do I tie a shoe, step by step? And how is that programming related?
    – user1228
    Jul 19, 2011 at 19:15
  • @Won't: if you can define a general-recursive function from an arbitrary set of input parameters to a description of a shoe-tying process, then it can be programmed, and we can discuss various algorithms by which it may be more-or-less efficiently implemented. I think you are fudging a bit on the definition of "algorithm": I mean a description, as Dijkstra would have it, of a class of computations---but which need not be tied to any particular instruction set or language. Jul 19, 2011 at 21:30
  • @DerrickTurk: All programming algorithms are algorithms, but not all algorithms are programming algorithms. If the algorithm isn't programming related, it does not belong here. It truly is a simple concept, one that I'd think someone with access to a dictionary could determine.
    – user1228
    Jul 19, 2011 at 21:33
  • 1
    @Won't: while your condescension is indeed much appreciated, you'll find that Merriam-Webster glosses "algorithm" as, first, "a procedure for solving a mathematical problem (as of finding the greatest common divisor) in a finite number of steps that frequently involves repetition of an operation"---that is to say, precisely the idea of "effective method" codified by the work of Turing! That is to say, an algorithm is precisely that which can be programmed on a general-purpose computing device. There cannot be such a thing as a "non-programming related algorithm" in any meaningful sense. Jul 19, 2011 at 21:39

Questions about computer science are officially on-topic on Stack Overflow. Algorithms are a branch of computer science, and they're even explicitly allowed by the FAQ.

I don't think this is optimal, and support the creation of a site about computer science. This has already been attempted several times, but all attempts were closed as duplicates of existing sites: CSTheory (which is ludicrous — CSTheory is research-level only) and Stack Overflow (which is not absurd, but I think inappropriate, in part because as you note questions that are too theoretical tend to be closed).

  • +1: There really is no middle ground in the Stack Exchange universe, for those of us who enjoy discussing algorithms at a more abstract level but haven't the credentials or experience to fit in at CSTheory. I wish SO would come to terms with the fundamental inseparability of mathematics and computer science ("programming" being in my mind an overly-narrow focus). Jul 19, 2011 at 21:33

I don't believe it's possible to draw a line in the sand cleanly delineating "programming-related" from "computer science" or "pure algorithms" questions. To respond openly to a comment on Won't's answer, viz.

All programming algorithms are algorithms, but not all algorithms are programming algorithms. If the algorithm isn't programming related, it does not belong here. It truly is a simple concept, one that I'd think someone with access to a dictionary could determine.

... well, I did consult a dictionary regarding this "simple concept". Here is Merriam-Webster's first definition for "algorithm":

a procedure for solving a mathematical problem (as of finding the greatest common divisor) in a finite number of steps that frequently involves repetition of an operation

Well, gee. That sounds an awful lot like the "effective methods" expounded upon by the work of Turing, Church, etc., doesn't it? Indeed, the definition of algorithm, in this primary sense, is precisely the class of programmable solutions to problems! How then could one possibly have such a thing as a "non-programming-related" algorithms question? Is "give me an algorithm to tie my shoes" a programming-related algorithm question? Well, if you can mathematically formalize the notion of shoe tying in such a way that a general-purpose computing device might be programmed to determine desirable ways to tie shoes---then yes! And if you cannot---then you are not asking for an algorithm at all, but a set of instructions, in the ordinary everday sense of that term.

As for the question in question, how can it possibly be invalid? Any attempt to divorce "math" from "programming" is doomed to failure: the entire theory of computation is built around the notion of "computable function"---and even the most abstract mathematical question permits endless discussion as to the merits---in terms of efficiency, readability, "elegance", and so on---of the possible ("programmable" by definition!) algorithms for its solution.

One of the reasons I've become less active on SO recently is a trend of trying to narrow the scope of allowed questions while pooh-poohing "abstract", "academic", or "mathematical" questions. While I'd like to chalk this up to anti-intellectualism and the "cult of the practical" I do believe those advancing this viewpoint have good intentions.

Unfortunately it leaves the rest of us in the lurch. As others have pointed out, if these types of questions are "too abstract" or insufficiently "programming-related" for SO, where on Earth do they belong? CSTheory.stackexchange is certainly not the answer---it's MathOverflow for the graduate, doctoral, and post-doctoral CS research crowd, and while I love lurking there to soak up some insight through osmosis, it's not an acceptable venue for questions at this level.

I would love to see StackOverflow embrace this middle ground. A practitioner-level "Computer Science" SE site might scratch the itch as well, but I fear that the audience may not be quite large enough to justify its existence.

  • "I don't believe it's possible to draw a line in the sand" No, it's not. However we have thousands of people who can vote to close (are re-open!), and Stack Overflow is run by the community on purpose. We have a large gray area. If you want to make certain that your question remains open, you need to spend a tiny bit of time making sure it is explicitly (not just implicitly) about a specific programming problem. If you like playing in the gray area, and you don't mind your question maybe getting closed, then go ahead and write the question for a different audience.
    – Pollyanna
    Aug 19, 2011 at 21:49

here's a well-known and important programming problem...triangle intersection.

The question is written as a math problem, not in terms of programming. If it's written for programmers, then it should be presented to programming experts. If it's written for mathematicians, then it should be presented to math experts.

The questions you are using as examples could have been about programming, but they weren't. They were about math, and you could answer them completely without writing code, further they weren't asking for software examples, nor did they show any code demonstrating a problem.

When a problem can be equally solved by two sites on stack exchange, the user should carefully consider what they want the answers to look like. If they want programming answers, they should ask their questions in terms of programming. If they want mathematical answers, they should write their questions in terms of math.

Writing for one crowd, and submitting to the other is bad because we want to attract and keep experts in each field on the site.

Questions that are off topic - even merely in the way they are written - are noise for those experts.

It's not a bad question. It's not a question we can't answer.

But it's not the right place for it OR it's not the right format for the question.

When you feel strongly about such a question, edit it so it specifically relates to programming, or flag it so a moderator moves it to the correct site.

It's important to note that it would have been on topic prior to the creation of math.stackexchange. There is an obvious overlap between the communities, but when you ask an expert for help, you don't simply barge into the expert who's help you want, and present your question in the wrong terms. You make it as easy for them to understand as you can, and you do it within their field of expertise.

While you can go to both a llama expert and a sheep expert and discuss sheering, you should choose the one that will most closely match your needs, and then you shouldn't waste their time or bore them by talking about it in terms of the other field.

Yes, they are similar, but you are asking someone for help. Go to the right person, use the right terminology for their field, and make it easy for them to give you the answer you need.

Otherwise you will eventually make them tired of people asking them questions about a subject they may know about, but they don't care to discuss. They're here to answer a specific type of question, and if we don't keep the site on topic, they're going to get tired of the noise.

  • 1
    "The question is written as a math problem, not in terms of programming" — You seem to be suggesting that computer programmers (or at least, Stack Overflow users) can't figure out that a question has algorithmic content unless it leads them by the hand to that conclusion. Are people really so clueless? Aug 19, 2011 at 20:52
  • "When you feel strongly about such a question, edit it so it specifically relates to programming" — how can I do this when the question has been closed? Aug 19, 2011 at 20:53
  • @Gareth: closed questions can be edited. You've attracted enough attention to that question here that, with the proper edits, it might be reopened. Or migrated even - a moderator flag would help with that. Aug 19, 2011 at 20:57
  • @Gareth I don't think you understand. It's not an issue of whether they are capably of understanding, or crossing disciplines. Further, you can always edit closed questions. Closing isn't the end of the question - it's a two day grace period (generally) to allow the original poster to repair the problems. Everyone can suggest an edit, 2k users can make an edit without approval.
    – Pollyanna
    Aug 19, 2011 at 20:59
  • I certainly don't understand. If it's not an issue about whether people understand, then what's the problem? If everyone understands that the question is asking "How can I determine if two triangles intersect (so that I can program it on a digital computer)?" then why close the question as off-topic? Aug 19, 2011 at 21:13
  • 1
    @Gareth The best answer I have given previously is, "Yes, someone here might be able to help you, but you'll find that other forums more focused on your topic can give you a much better answer than a bunch of programmers. It's likely that your question will be downvoted, closed, and in some cases marked "offensive." It's not that we hate you, it's just that we're programmers and we like to keep our corn pops separate from our cocoa puffs."
    – Pollyanna
    Aug 19, 2011 at 21:18
  • @Gareht But I have approached this question many, many times in the past. Consider reading through some of these very similar questions: meta.stackoverflow.com/search?q=laser+sharp+focus+user%3A2915
    – Pollyanna
    Aug 19, 2011 at 21:20
  • @Gareth I'm sorry to hear that you don't feel you would fit in due to the site's exclusive nature. Looking over your answers, you obviously have a great deal of expertise in this area, and I would be sad to see you leave. Keep in mind that you have the power to vote to reopen such questions, and you did get a number of upvotes on this suggestion, and so far no downvotes. It's an issue worth fighting for, and it's not written in stone. It's similar to a line that always moving, or an undefined gray area. I'm certain we could benefit from you tugging in the other direction.
    – Pollyanna
    Aug 19, 2011 at 21:32

Not the answer you're looking for? Browse other questions tagged .