【问题标题】:How to check whether a linked list is sorted or not using c++?如何使用 C++ 检查链表是否已排序?
【发布时间】:2016-03-08 12:29:53
【问题描述】:

如何使用 c++ 检查数组或链表是否已排序或未给定一组数字?有没有可以检查的功能?

【问题讨论】:

标签: c++ arrays sorting linked-list


【解决方案1】:

只需使用std::is_sorted 类似的东西:

if (std::is_sorted(std::begin(linked_list), std::end(linked_list)) {
    //...
}

【讨论】:

    【解决方案2】:

    检查这个堆栈溢出链接希望你能得到答案。

    How do I code a function to test if a linked list is sorted

    【讨论】:

      猜你喜欢
      • 2020-08-20
      • 2020-07-26
      • 1970-01-01
      • 2011-06-10
      • 1970-01-01
      • 2018-12-18
      • 2016-09-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多