0

I wonder whether it is necessary to use third-person singulars for the verbs in the step-form algorithm description, which I explain now.

The first version is without third-person singulars.

The algorithm A has the following steps:

  • Compute B=f(A).
  • Check whether g(B)=1.
  • Output h(B).

The second version uses third-person singulars.

The algorithm A has the following steps:

  • Computes B=f(A).
  • Checks whether g(B)=1.
  • Outputs h(B).

Which one is more grammatically correct?

2
  • If the algorithm itself performs those functions, then you'd use the second version. If you are giving someone step-by-step instructions on what they must do to carry out the algorithm's functions, then you'd use the first version.
    – Billy
    Commented Jul 10, 2018 at 3:40
  • @Billy Thanks, Billy. Does the second point you mentioned, "give someone step-by-step instructions...", mean imperative mood? Commented Jul 10, 2018 at 3:45

1 Answer 1

1

In my experience, we invariably use the plain form (compute, check, output). I imagine that this is because the algorithm is essentially a set of instructions, similar to those for a laboratory experiment, a recipe, etc., so it uses the imperative mood with an implied second-person subject; and indeed, although we often think of algorithms as being executed by computer programs, they are often executed by humans, and have been for millennia. (And that's not just from a modern perspective; the very word algorithm long predates computing machines.)

That said, if you prefer, you can probably just think of them as bare infinitive phrases; I can't imagine any algorithm steps being negated (imperative "don't X" vs. bare infinitive "not X") or referring directly to the reader ("While holding the array A in your left hand, slowly shuffle array B into it"), so for all intents and purposes that should be equivalent.

2
  • If the algorithms are running on servers, or the algorithm is a sub-algorithm run by another algorithm, does imperative mood still work here? Commented Jul 10, 2018 at 3:47
  • @WeikengChen: Yes. A prose description of an algorithm can use other forms (such as the present passive indicative), but a list-of-steps description always uses the plain form.
    – ruakh
    Commented Jul 10, 2018 at 3:58

You must log in to answer this question.

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