0

In this section, we use a similar technique to solve the sorting problem, that is, starting with an unordered array of elements and rearranging them into non-decreasing order.

This line is taken from a coding textbook where they are basically discussing sorting algorithms. Sorting algorithms either sort in an increasing order or a decreasing order depending on the input type.

Does the word non-decreasing here mean same as that of increasing? Is there any particular situation where they have different meanings? Also, can these two words be used interchangeably in a context?

1
  • The answer given is correct. However, there is no doubt that a lot of the time (certainly in less technical speech) "increasing order" means the same thing as "non-decreasing order". If someone asked me to sort 1, 2, 3, 4, 4 into increasing order, I would simply sort them into non-decreasing order. I wouldn't say "oh, no, that's impossible".
    – rjpond
    Sep 21 '20 at 6:31
3

No, the difference is behavior at the limit.

  • Non-decreasing includes both increasing and level ordering; e.g., 1, 2, 3, 3, 4.
  • Increasing excludes steady-state, so in the previous example, "3, 3" is not allowed.

Compare with similar math operators, greater-than (>) vs. greater=than-or-equal-to (>=).

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.