3

Which of these sentences should I use?

Algorithms 1 and 2 work in time O(n) and O(n^2) respectively.

Or

Algorithms 1 and 2 work in times O(n) and O(n^2) respectively.

4
  • 2
    Throw it out altogether. Seriously. Nobody says, "works in time O(n)". Everybody says, "runs in O(n)".
    – RegDwigнt
    Jun 6, 2012 at 21:12
  • You're somewhat right one one point. It isn't as common to say that an algorithm "works in time" as opposed to "runs in time." However, neither of those are technically correct. Instead, you would say that an algorithm has a computational complexity of O(n). Jun 6, 2012 at 21:36
  • @RegDwight: You might speak of "runtime[s]" x and y respectively. The fact that we don't normally use "work[s] in time" this way has no real bearing on whether to pluralise the noun/adjective/attribute/whatever we call the word here manifest as "time". Jun 6, 2012 at 22:05
  • The real sentence was whose small side has volume at least A in time O(B) and O(C) respectively. I wrote it that way for summarization. Is this sentence still wrong?
    – Shayan
    Jun 6, 2012 at 22:15

2 Answers 2

3

"Algorithms 1 and 2 work in times O(n) and O(n^2) respectively." is correct.

The two algorithms (pl) work in the two times. The sequence of the times correlates to the sequence of the algorithms, i.e. it is respective.

You can omit "respectively" in such a short sentence, or say "Algorithm 1 works in time O(n), and algorithm 2 works in time O(n^2)." to be very clear.

Cheers

1

I don't think "rules of grammar" are concerned with such fine points - both singular and plural are used in OP's context, so it's really just a matter of stylistic preference. But OP's specific word "time" is just one of many - the same construction arises in, for example...

Smith and Jones won first and second prize, with pumpkins of weight[s] 24kg and 18kg respectively.

...where again, either form works. But with some slight changes, only plural works...

Smith and Jones were the richest, with fortunes of £86M and £71M respectively.

Smith and Jones were the most generous, making donations of £86K and £71K respectively.

If you parse time/weight/etc. as a noun modified by the two numeric values following, you naturally pluralise it. But if you parse the numbers themselves as the relevant "nouns", the preceding term becomes a modifying "adjective" - a singular attribute applicable to both values.

Without doing any research into actual usage I suspect that the plural is more common, if only because it works better in a broad range of closely-related constructions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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