如何检查链接的列表是否排序或不使用C ++?

如何检查链接的列表是否排序或不使用C ++?

问题描述:

如何检查数组或一个链表是否排序或不给定一组用c ++的数字?是否有可用的一个函数来检查?

How to check whether an array or a linked list is sorted or not given a set of numbers using c++?. Is there a function available to check that?

只需使用的std ::已排序是这样的:

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