Learn C++ STL

Lesson 2 of 9 · The Algorithms You Will Use Weekly: accumulate to nth_element

Module 14 · The Algorithms You Will Use Weekly: accumulate to nth_element

Every Algorithm in the Weekly Set, One by One, With Its Cost

Free with an accountReading

Zara's weather station logs one reading every hour. Bob gets eleven questions about one day's log, such as the total, the hottest hour and the first hour above 35. He writes eleven loops, and two of them are wrong. Every one of those questions has one call in the standard library. Each call also has a cost, and you should know it before you run the call on a million readings.

Checking what this lesson needs for you…

What is inside Every Algorithm in the Weekly Set, One by One, With Its Cost

  1. accumulate: a total in the type you choose
  2. partial_sum: every running total at once
  3. iota: count up into a range
  4. inner_product: pairs multiplied, then added
  5. count and count_if
  6. find and find_if: the first match, or end()
  7. min_element, max_element and minmax_element
  8. reverse: turn a range around
  9. rotate: move the front to the back
  10. unique: sort first, erase after
  11. next_permutation and prev_permutation
  12. nth_element: one position put rightIntermediate
  13. partial_sort: the k smallest, in orderIntermediate
  14. fill and copy
  15. transform: one range in, one range out
  16. all_of, any_of and none_of
  17. swap and iter_swap
  18. Every cost in one table, and a measurement