Jump to content

Algorithm (C++)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 94.8.102.141 (talk) at 20:05, 12 December 2010 (A few algorithms). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In the C++ programming language, algorithms are components that perform algorithmic operations on containers and other sequences.[1]

The C++ standard provides some standard algorithms collected in the <algorithm> standard header. All algorithms are in the std namespace.

Category

  • Non-modifying sequence operations (e.g. find_if, count, search)
  • Modifying sequence operations (e.g. replace, remove, reverse)
  • Sorting (e.g. sort, stable_sort, partial_sort)
  • Binary search (e.g. lower_bound, upper_bound)
  • Heap (e.g. make_heap, push_heap)
  • Min/max (e.g. min, max)

A few algorithms

  • void copy(ForwardIterator source_begin, ForwardIterator source_end, ForwardIterator destination_begin)
  • void fill(ForwardIterator destination_begin, ForwardIterator destination_end, T value)
  • ForwardIterator find(ForwardIterator begin, ForwardIterator end, T search_object) (returns an iterator the found object or end if the object isn't found)
  • T max(T a, T b) returns the greater of the two arguments
  • ForwardIterator max_element(ForwardIterator begin, ForwardIterator end) finds the maximum element of a range
  • T min(T a, T b) returns the smaller of the two arguments
  • ForwardIterator min_element(ForwardIterator begin, ForwardIterator end) finds the minimum element of a range

what is this i am not understanding

References

  1. ^ ISO/IEC (2003). ISO/IEC 14882:2003(E): Programming Languages - C++ §25 Algorithms library [lib.algorithms] para. 1