is a “non-decreasing” sequence “increasing”?

后端 未结 8 658
梦如初夏
梦如初夏 2020-12-23 16:27

While studying the book \"Introduction to Algorithms by Cormen\", I found a strange thing. Everywhere if it refers to an increasing order, the book refers it as \"non-decrea

8条回答
  •  生来不讨喜
    2020-12-23 16:49

    Non-decreasing means exactly that. It's not quite the same as increasing, since it does not tell you what to do with identical values.

    Consider the sequence 1, 2, 2, 3, 4 . It's a non-decreasing sequence because the values are in order, yet do not strictly increase from value to value ( ie, 2 is not greater than 2).

提交回复
热议问题