Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Algorithm

 

Algorithm has multiple meanings:

 

 

 

 

 

Algorithm (general)

 

An algorithm is a process to be followed in a calculation.

 

Algorithms can be modified by adapters, binders and negaters.

 

 

 

 

 

STL algorithms

 

Most algorithms can be found in the header file algorithm.h.

 

Non-standard algorithms lack the std prefix.

 

The C++11 algorithm names [3]:

 

  1. C++98C++11 std::accumulate
  2. C++98C++11 accumulate_if
  3. C++98C++11 std::adjacent_find
  4.  C++11 std::all_of
  5.  C++11 std::any_of
  6. C++98C++11 std::binary_search
  7. C++98C++11 std::copy
  8. C++98C++11 std::copy_backward
  9. C++98C++11 copy_if
  10.  C++11 std::copy_if
  11.  C++11 std::copy_n
  12. C++98C++11 std::count
  13. C++98C++11 std::count_if
  14. C++98C++11 std::equal
  15. C++98C++11 std::equal_range
  16. C++98C++11 std::fill
  17. C++98C++11 std::find
  18. C++98C++11 std::find_end
  19. C++98C++11 std::find_first_of
  20. C++98C++11 std::find_if
  21.  C++11 std::find_if_not
  22. C++98C++11 std::for_each
  23. C++98C++11 std::generate
  24. C++98C++11 std::generate_n
  25. C++98C++11 std::includes
  26. C++98C++11 std::inner_product
  27. C++98C++11 std::inplace_merge
  28.  C++11 std::iota
  29.  C++11 std::is_heap
  30.  C++11 std::is_heap_until
  31.  C++11 std::is_sorted
  32.  C++11 std::is_sorted_until
  33. C++98C++11 std::iter_swap
  34. C++98C++11 std::lexicographical_compare
  35. C++98C++11 std::lower_bound
  36. C++98C++11 std::make_heap
  37. C++98C++11 std::max
  38. C++98C++11 std::max_element
  39. C++98C++11 std::merge
  40. C++98C++11 std::min
  41. C++98C++11 std::min_element
  42.  C++11 std::minmax
  43.  C++11 std::minmax_element
  44. C++98C++11 std::mismatch
  45.  C++11 std::move
  46.  C++11 std::move_backward
  47. C++98C++11 std::next_permutation
  48.  C++11 std::none_of
  49. C++98C++11 std::nth_element
  50. C++98C++11 std::partial_sort
  51.  C++11 std::partial_sort_copy
  52. C++98C++11 std::partition
  53.  C++11 std::partition_copy
  54.  C++11 std::partition_point
  55. C++98C++11 std::pop_heap
  56. C++98C++11 std::prev_permutation
  57. C++98C++11 std::push_heap
  58. C++98C++11 std::random_shuffle
  59. C++98C++11 std::remove
  60. C++98C++11 std::remove_copy
  61. C++98C++11 std::remove_copy_if
  62. C++98C++11 std::remove_if
  63. C++98C++11 std::replace
  64. C++98C++11 std::replace_copy
  65. C++98C++11 std::replace_copy_if
  66. C++98C++11 std::replace_if
  67. C++98C++11 std::reverse
  68. C++98C++11 std::reverse_copy
  69. C++98C++11 std::rotate
  70. C++98C++11 std::rotate_copy
  71. C++98C++11 std::search
  72. C++98C++11 std::search_n
  73. C++98C++11 std::set_difference
  74. C++98C++11 std::set_intersection
  75. C++98C++11 std::set_symmetric_difference
  76. C++98C++11 std::set_union
  77. C++98C++11 std::sort
  78. C++98C++11 std::sort_heap
  79. C++98C++11 std::stable_partition
  80. C++98C++11 std::stable_sort
  81. C++98C++11 std::swap
  82. C++98C++11 std::swap_ranges
  83. C++98C++11 std::transform
  84. C++98C++11 std::unique
  85. C++98C++11 std::unique_copy
  86. C++98C++11 std::upper_bound

 

 

 

 

 

Advice

 

 

 

 

 

 

References

 

  1. Bjarne Stroustrup. The C++ Programming Language (3rd edition). ISBN: 0-201-88954-4. Chapter 18.12.1: 'Prefer algorithms to loops'.
  2. Scott Meyers. Effective STL. ISBN: 0-201-74962-9. Item 43: 'Prefer algorithm calls over hand-written loops'
  3. Bjarne Stroustrup's C++0x FAQ page
  4. Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 23.8, page 698: '[1] Use templates to express algorithms that apply to many argument types'

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict