-3
如何檢查一個數組或鏈表是否被排序或沒有使用C++?給定一組數字?有沒有可用於檢查的功能?如何檢查鏈表是否使用C++排序?
如何檢查一個數組或鏈表是否被排序或沒有使用C++?給定一組數字?有沒有可用於檢查的功能?如何檢查鏈表是否使用C++排序?
只需使用std::is_sorted
類似:
if (std::is_sorted(std::begin(linked_list), std::end(linked_list)) {
//...
}
檢查這個堆棧溢出鏈接希望你得到它你的答案。
[性病::已排序(http://en.cppreference.com/w/cpp/algorithm/is_sorted) – Jarod42
http://stackoverflow.com/questions/35182013/how-can- i-check-if-vector-elements-is-order-order- –
Cody Grey剛剛發佈的鏈接上的最佳答案。試着在這裏用一些關鍵字搜索一下,然後再問:) – George