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?
Simply use std::is_sorted something like:
std::is_sorted
if (std::is_sorted(std::begin(linked_list), std::end(linked_list)) { //... }
1.4m articles
1.4m replys
5 comments
57.0k users