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)) { //... }
2.1m questions
2.1m answers
60 comments
57.0k users