is_sorted and is_sorted_until algorithms