Showing posts with label STL. Show all posts
Showing posts with label STL. Show all posts

Friday 30 June 2017

STL Algorithm

Algorithm Used in Vector

(i) Non-Manipulating Algorithms:
          1. sort(first_iterator,last_iterator)-To sort a given vector.
          2. reverse(first_iterator,last_iterator)-To reverse a given vector.
          3. *max_element(first_iterator,last_iterator)-To find the maximum element of a vector
          4. *min_element(first_iterator,last_iterator)-To find the minimum element of a vector 
          5. accumulate(first_iterator,last_iterator.initial value of sum)-Does the summation of vector elements.
          6. count(first_iterator,last_iterator,x)-Count the occurrence in vector.
          7. find(first_iterator,last_iterator,x)-Points the last address of the vector if the element is not found