![]() |
In C++, sets are a type of associative container in which each element has to be unique because the value of the element identifies it. It provides reverse iterators that make it easier to traverse the set in reverse direction. In this article, we will discuss how to traverse a set with reverse_iterator in C++. Example Input: Traverse a Set with reverse_iterator in C++Reverse iterators in C++ are used to traverse the set backward. The std::set has two member functions that provide the reverse iterators:
C++ Program to Traverse a Set with reverse_iteratorC++
Output
100, 90, 80, 70, 60, 50, 40, 30, 20, 10, Time Complexity: O(N) |
Reffered: https://www.geeksforgeeks.org
C++ |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |