137

Is it ok if I pose/quote an algorithmic problem and just ask for a solution to it? Or at least can I ask users to point me in the right direction (give me the name of a known algorithm/tell me where to look for)?

12
  • 6
    Might it be better on programmers? Commented Sep 22, 2014 at 1:42
  • 2
    If by an algebra/mathematic algorithm, perhaps it would be better on the math site.
    – warspyking
    Commented Sep 22, 2014 at 1:55
  • 9
    @MatthewLundberg Programmers.SE is no more a "give me the algorithm" site than Stack Overflow is a "give me the code" site. Major difference there, is that because P.SE has a low enough volume we actually have a chance of enforcing that with close votes in a timely manner.
    – user289086
    Commented Sep 22, 2014 at 2:09
  • @MichaelT Thanks, I'm not active there, but of course that is to be expected. Commented Sep 22, 2014 at 2:10
  • 5
    difficult to say, it relly depends on your question and the thoroughness of it. if it sounds like simply "give me" then it wouldn't be as likely Commented Sep 22, 2014 at 2:13
  • 167
    Folks, asking is this sort of thing acceptable on the site is precisely how people that aren't sure try to avoid irritating others before actually going and doing it. If you down-voted this post by someone that actually checked before doing something, then you're just discouraging people from doing the very thing we want them to do. No one is proposing that this should be okay, they're just asking if it is okay, because they (presumably) don't know. What purpose does down-voting something like this serve, other than making someone feel bad about doing what we asked them to do?
    – user50049
    Commented Sep 22, 2014 at 7:23
  • @TimPost: Might have had something to do with it being tagged discussion and not support. Good thing you finally corrected that. Besides that, I certainly concurr. Commented Sep 22, 2014 at 9:00
  • 8
    @Deduplicator "Support" is described as "A request for assistance with one of the site's features." What I was asking wasn't IMO a feature so I didn't use this tag. Honestly, no tag (of the 4 to choose from) seemed fit for my question.
    – NPS
    Commented Sep 22, 2014 at 11:12
  • 7
    @TimPost Meta downvotes are typically used as "I disagree with the premise of this question" because it doesn't affect reputation. If it's starting to happen on Meta Stackoverflow, that just means users are starting to see it like a site-specific meta site instead of the whole-stackexchange meta like it used to be.
    – Izkata
    Commented Sep 22, 2014 at 13:45
  • @TimPost: how many times more will you repeat it with the SE crew without addressing this issue in its core? Commented Sep 22, 2014 at 17:48
  • 4
    @izkata I hope you see the irony of trying to explain how meta votes work to a guy who gets paid to sit on meta all day.
    – corsiKa
    Commented Sep 23, 2014 at 20:05
  • @corsiKa Depends on what meta he sits on all day. If it was mostly/only Meta.SO before the split into MetaSE (which is possible given his role), he might not have picked up on it.
    – Izkata
    Commented Sep 23, 2014 at 22:52

3 Answers 3

126

In all questions, you should clearly state what you're trying to accomplish. Something like this:

I want to implement a search that first goes to the most distant (or possibly least relevant) nodes first, indexes them, and then works its way back to the beginning. I've tried recursive directory searches, but those end up stopping at the most distant nodes instead of actually starting there. Here's some of the code I've been using. Note, this works (technically), but doesn't do what I want ..

And of course someone is likely to answer:

Oh, you want a breadth-first search. Those can be tricky, here's an example of how you could do it ..

Just explain the problem as well as you can, and if there's a known algorithmic solution that actually pertains to your described implementation, someone is sure to let you know what it is. Where I think we could be a little more lenient is judging the perceived level of effort someone put into solving their problem, because occasionally you really do keep hitting a blank screen every time you try to actually write something.

So, if you're doing a really complicated sort, just describe the input, the desired output, the expected complexity and all thinking you've put into it if you don't yet have code to post. It's not that folks don't want to just give you an answer, they just want to make sure someone else trying to find a shortest-path implementation is likely to find their answer as well, so you really need to describe the problem in order to make it easier for folks to discover. Knowing precisely where you're stuck also helps folks cut right to the chase in their answer, you've optimized for their time, and that's important.

It's downright hard to search for something if you don't know what you're searching for, and folks do take that into consideration. But, simply stating:

I need an algorithm that accomplishes {work}

... is a bit presumptuous, and will likely be interpreted as this is hard, so I want someone else to do it for me, and it won't be well-received.

2
  • 37
    +1 Your answer hits the nice balance between the effort that the people want to see before answering a question, and the fact that algorithm questions don't always have "half a solution" that can be presented like normal programming questions.
    – nhahtdh
    Commented Sep 22, 2014 at 7:19
  • 5
    More concisely: Yes, it is OK (because the help on topics mentions "a software algorithm" as one of the typical question topics), but (1) do some searching yourself before and (2) make sure you describe your problem well. Both is discussed in the help on question form. Commented Sep 24, 2014 at 15:22
14

If you're talking about programming contest questions: State which contest it's from and be sure that contest is over before asking. Don't just copy the question wholesale; you don't own the copyright. I, and probably quite a few others, really don't like seeing programming contest question dumps here, especially from active contests.

If you're talking about questions that actually arise in practice: Ask away. But don't just give us an idealised version of what you think is important about the problem; give as many details of your use case as you can. This sort of question is explicitly permitted by the help centre, and they're quite often very interesting.

2

The important thing is - why do You need this answer?

For students who try to solve their homework copy-ready solutions will not give any benefit.

For people who are not familiar with programming and need to solve particular problem, then never get back to it - complete solution is best answer.

For people who ask questions because it's work-related ( or simply, they earn money by this ), time sometimes is more valuable than fully understanding the solution and logic beneath it. They can analyse it later.

So shortly - yes, you can ask such questions if you need. I think it's our personal response ability to value experience over solution sometimes.

1
  • Maybe I didn't specify my question - I meant asking for an algorithm/name of a known algorithm, not for a code.
    – NPS
    Commented Sep 24, 2014 at 17:08

You must log in to answer this question.

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