Skip to content

Commit

Permalink
Merge pull request Bhupesh-V#506 from akash-arelli/master
Browse files Browse the repository at this point in the history
Added is_sorted_until.md
  • Loading branch information
Bhupesh-V authored Oct 5, 2020
2 parents 13f8a93 + 9e53861 commit 7d8294d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions algorithm/is_sorted_until.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# is_sorted_until

**Description :** std::is_sorted_until is used to find out the first unsorted element in the range [first, last). It returns an iterator to the first unsorted element in the range, so all the elements in between first and the iterator returned are sorted.</p>


**Example** :

```cpp
#include <iostream>
#include <algorithm>

using namespace std;
int main()
{
int v[] = { 1, 2, 3, 4, 7, 10, 8, 9 }, i;

int* ip;

// Using std::is_sorted_until
ip = std::is_sorted_until(v, v + 8);

cout << "There are " << (ip - v) << " sorted elements in "
<< "the list and the first unsorted element is " << *ip;
return 0;
}
```
**[Run Code](https://rextester.com/NLRDYA45690)**

0 comments on commit 7d8294d

Please sign in to comment.