Recently, the question was about this algorithm. By standard, it accepts sorted sequences, but I always gave the correct result for unsorted sets. For example:
std::vector<int> a{1, 2, 5, 3, 11, 23, 12, 6}; std::vector<int> b{5, 3, 11}; if (std::includes(a.begin(), a.end(), b.begin(), b.end())) cout << b.back(); // вывод 11 And, just in case, the reference to the standard: https://ru.cppreference.com/w/cpp/algorithm/includes I think it’s just that the algorithm works faster for sorted sets and does not sort the unsorted ones (or doesn’t sorting be necessary?). I have not figured it out yet, I would like to receive help from you (what is your answer? ...) Simply, it is purely logical, the sorting is not needed at all ...