void reverse(BidirectionalIterator first, BidirectionalIterator last) BidirectionalIterator is an iterator that can be used to access any elements of a container in both forward and backward direction.
Examples:
1 2 3 4 5 6 7 8
Input : 10 11 12 13 14 15 16 17 Output :10 11 12 13 14 17 16 15 Explanation: reverse(v.begin() + 5, v.begin() + 8); In the above function, input we have applied reverse() on the vector from index 5 to index 7. Therefore when we display the vector we get reverse order from index 5 to index 7.