To extend this question:

Which is correct: "the variable X" or "variable X" or "the X variable"?

1) what is the best/correct use:

1.1) "the X algorithm",

1.2) "the algorithm X",

1.3) or "algorithm X"?

For example it is said "the A* algorithm", but in the same Wikipedia page it is also written "Algorithm A".

2) What is the difference with "the variable X" (see the link above)?

Thank you in advance.


If X is a stand-in for an actual, named algorithm, then X Algorithm is usually the correct construction. For example:

  • The A* algorithm
  • The DFS shortest path algorithm
  • Kruskal's Algorithm

The wikipedia page you cite isn't using "Algorithm A" to mean the same thing as "A* algorithm." It's using "Algorithm A" as shorthand for "Any algorithm, which we will refer to as A." Likewise, it describes "Problem P." P isn't some special problem, it's a stand in for an arbitrary problem that we are using A to solve.

To put it in terms of integers:

4 is an integer. (Just like A* is an algorithm)

Let integer i be an integer less than 5. i could be 4, or it could be 1, 2, 3, or -8. It's not necessarily 4. integer i is analogous to algorithm A.

The variable X vs the X variable

I suspect there isn't an actual grammatical rule here, and it's entirely dependent on what field you're in, or who you're talking to. I personally hear all of these on a fairly regular basis and would never misunderstand.

I would bet, though, that a phrase like "the x variable" is more likely to be used in the context of describing a cartesian plane. "The x variable" can be used as a property of the graph rather than a specific thing with a specific value.

"The variable X" is more likely to be used when talking about a literal variable in a snippet of code called X. Just like one might say "the dog Spot" (there is a dog and its name is Spot), the thing you're talking about is a variable, and its name is X.

With that said, if you're writing for a specific journal or at a certain instutution they might have an explicit style guide. Otherwise you're probably in the clear and the audience will understand perfectly well.

  • Perfect answer, now I understand the difference. – moth Nov 29 '19 at 16:48
  • @ pip install Monica, I corrected your answer by adding "the" before "integer i", but now that I'm thinking about it I'm no longer sure. According to the use of "the" in "the variable x" it is correct, isn't it? Otherwise why would it be different? In fact, it's the 2) of my question that has been left unanswered. – moth Dec 1 '19 at 14:01
  • Thank you very much for your edit, it's very clear concerning "the variable X" vs. "the X variable" but you missed one of my interrogations: why did you write "let integer i" and not "let THE integer i"? "Integer i" is here considered as a variable, isn't it? – moth Dec 4 '19 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.