3
$\begingroup$

I didn't want to ask a bad question, so I wanted to know if question of those "types" are welcome or not. Note here that I do mean that with adequate details (eg: give example of existing one, show research effort, and explain the searched algorithm in a sensible manner).

Any feedback appreciated.

$\endgroup$
4
  • $\begingroup$ It's not entirely clear to me what type of questions you are describing. A computer program can implement something (such as an algorithm), but an algorithm is usually not considered to be an implementation of something. So I think it would depend on what sort of thing "X" is. Could you clarify what the relation with X and the algorithm is, perhaps with an example? I'm also not sure what you mean by "existing algorithm" here. If I someone describes an algorithm in an answer, it exists. Perhaps you mean whether the algorithm is known (with a reference) or well known? $\endgroup$
    – Discrete lizard Mod
    Mar 7, 2023 at 8:44
  • $\begingroup$ I meant to say, if X was a description or explanation for a possible/existing or not, implementation for a specific algorithm. If I show or briefly show research effort on existing algorithm, and say something along the line of "I notice that all of them depends/do Y, but is there any existing ones that doesn't do that? and instead do X?" @Discretelizard $\endgroup$ Mar 7, 2023 at 8:47
  • $\begingroup$ If X/Y are about the algorithm itself and not about its implementation in a specific programming language, I think it should be fine, although it would be good to clarify in the question whether you want the algorithm modified with X for a specific reason, or whether you want to learn why Y is done instead of X. If the distinction is mostly about the implementation in a specific programming language, it would be better to ask on Stack Overflow. $\endgroup$
    – Discrete lizard Mod
    Mar 7, 2023 at 8:59
  • $\begingroup$ yeah, I wouldn't ask for the code/implemented algorithm itself. Just why (as you mentioned) and maybe ask for possible existing algorithm that does not need Y, etc. @Discretelizard $\endgroup$ Mar 7, 2023 at 9:07

1 Answer 1

4
$\begingroup$

Rather than asking "is there any existing algorithm that does X?", rather, I suggest you ask how to do X. That gives you two ways to win. One way is that someone points to a standard algorithm in the literature to do X. Another way is that someone comes up with their own algorithm to do X. Either way, you obtain a way to solve your problem.

I anticipate that will generally be acceptable. Algorithms are on-topic here.

In many cases, a helpful way to specify the task "X" is to describe what is the input to the algorithm, and what is the desired output (e.g., what properties the output must satisfy, to count as a correct output).

I would be wary of a question that asks for an algorithm to "do X without Y". That might depend on what "Y" is. If you ask that kind of question, I encourage you to make sure you are stating the actual requirement, and ideally provide motivation for that requirement.

For instance, asking how to compute shortest paths without using Dijkstra's algorithm would generally not be a good question, because it doesn't explain why you have rejected Dijkstra's algorithm, and consequently it will be hard to know whether any proposed algorithm will be acceptable to you (perhaps you will reject other proposals as well for the same reason you rejected Dijkstra's algorith, but since you haven't specified what are the positive requirements you need satisfied, it will be impossible to tell in advance). Also, there are many ways to craft an algorithm that superficially doesn't look like it is Dijkstra's algorithm but secretly, "under the covers" is related to Dijkstra's algorithm. A better question would be "how do I compute shortest paths, when some edges might be negative? I can't use Dijkstra's algorithm because it doesn't handle negative edges". That is better, because it specifies the positive requirement (must handle arbitrary graphs, even with negative edges).

$\endgroup$
1
  • $\begingroup$ Thanks, this is really in-depth. With your answer and what Discretelizard said in the comments, I think I got it now. $\endgroup$ Mar 8, 2023 at 9:06

You must log in to answer this question.

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