I don't understand the terminology in your help center. And so want to know if this is on-topic or if you know if my potential questions would be better answered elsewhere.

I contribute to Code Review which allows performance and complexity requests. Normally I can figure out some way to improve performance, however sometimes I can't but would like to know how. Here are some examples:

  • This question is a brute-force solution to find the best combination of items to eat. It is possible to improve the performance from an algorithm point of view. (As shown in my answer, and another)
  • This question used a brute-force solution to find the amount of unique permutations to a nucleotide. It was possible to find a purely mathematical solution to the problem.
  • I have my own problem that I've found a brute-force solution, but can't figure out a better solution. Fundamentally it boils down to:

    You have some curves, $C$, they all exhibit the following properties:

    • Range($\mathbb{N}$): [0,1]
    • Domain($\mathbb{Z}$): [0, 99]
    • Increasing: $C_{i} \le C_{j}$ when $i \le j$

    Given $n$ levels($\mathbb{Z}$) and $5$ curves find the highest sum of these curves where the domain total the levels.

    If there were two curves it would mathematically be: $i + j = n$, find $\max{C_{1.i} + C_{2.j}}$.

Would highlighting the problem and a solution in English/pseudocode, and asking for improvements to the solution be on-topic here?

  • $\begingroup$ I see you haven't asked a question yet. If you have any further problems with posing your question, feel free to ask in Computer Science Chat. $\endgroup$
    – Discrete lizard Mod
    Commented Apr 17, 2019 at 17:34
  • $\begingroup$ @Discretelizard Thanks! Will do :) $\endgroup$
    – Peilonrayz
    Commented Apr 17, 2019 at 17:50
  • $\begingroup$ When you post the question, will you add a link here? $\endgroup$
    – Oliphaunt
    Commented Apr 30, 2019 at 19:33
  • $\begingroup$ @Oliphaunt It's probably a terrible question, but here it is cs.stackexchange.com/q/108820 $\endgroup$
    – Peilonrayz
    Commented May 1, 2019 at 14:16

2 Answers 2


Those things are ontopic, but you have to be careful to post an answerable question.

"What is the most efficient algorithm for this problem?" is usually more of a research prompt without clear-cut best answers (since there are many cost measures to choose from) and frequently no answer (since lower bounds are hard to come by). Asking for a "better" algorithm has similar problems, and admits near-trivial answers.

Ask for an algorithm with specific, well-defined properties. Try to lay out why you think such an algorithm should exist, and tell us about approaches you tried without success.


Yes, such a question would be on-topic. It falls under “algorithms”, which is an important concept in computer science. Some major areas of computer science around algorithms are looking for algorithms to accomplish a certain task, looking for better algorithms (faster, more resilient, etc.), proving properties of algorithms, analyzing the complexity of algorithm.

The main thing related to algorithms that would be off-topic here is implementing an algorithm in a programming language.

Even if your question is on-topic, you need to make sure that it's answerable. If your problem comes from some applied field, you should explain application-specific concepts in generic mathematical terms. In the fragment you posted, what do you mean by “Range($\mathbb{N}$): [0,1]” — range of what? Why are there two sets here? Same questions about the domain. What is a curve in this context, and what does it mean to add them? What does “$n$ levels($\mathbb{Z}$)” mean? What does “the domain total the levels” mean?

When asking about performance, it's important to specify the order of magnitude of the values you're interested in. I think you did that with “[0,1]” and “[0,99]” but I'm not sure because I don't understand what these numbers refer to. Also, if there are multiple parameters, be sure to specify which parameter(s) you're optimizing for, and if applicable what constraints apply (e.g. memory vs performance compromise).

  • $\begingroup$ I tried to keep the example question succinct. To make sure I don't make a similar error again, would the following set build notation be 'ok'. What is preferred notation? "The curves domain is $\{d \in \mathbb{N}: 0 \le d \le 99\}$." $\endgroup$
    – Peilonrayz
    Commented Apr 12, 2019 at 20:18
  • $\begingroup$ @Peilonrayz That's a mathematically formal way to write it. It's clear, and it's fine, but in this case you could use English. “$d$ is an integer between 0 and 99” would be less clear because in English it's ambirguous: 0 and 99 may or may not be possible values, but you could write “$d$ is an integer between 0 and 99 inclusive”. In this particular case I think the most readable phrasing would be a mixture of english and math: “$d$ is an integer in the range $[0, 99]$”. But that's really a minor detail, don't worry about it. $\endgroup$ Commented Apr 12, 2019 at 20:38

You must log in to answer this question.

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