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
- accumulate: a total in the type you choose
- partial_sum: every running total at once
- iota: count up into a range
- inner_product: pairs multiplied, then added
- count and count_if
- find and find_if: the first match, or end()
- min_element, max_element and minmax_element
- reverse: turn a range around
- rotate: move the front to the back
- unique: sort first, erase after
- next_permutation and prev_permutation
- nth_element: one position put rightIntermediate
- partial_sort: the k smallest, in orderIntermediate
- fill and copy
- transform: one range in, one range out
- all_of, any_of and none_of
- swap and iter_swap
- Every cost in one table, and a measurement