Exercises

  1. 16.4 State whether each of the following is true or false. If false, explain why.

    1. Because Standard Library algorithms process containers directly, one algorithm can often be used with many different containers.

    2. Use the for_each algorithm to apply a general function to every element in a range; for_each does not modify the sequence.

    3. By default, the sort algorithm arranges the elements in a range in ascending order.

    4. Use the merge algorithm to form a new sequence by placing the second sequence after the first.

    5. Use the set_intersection algorithm to find the elements from a first set of sorted values that are not in a second set of sorted values (both sets of values must be in ascending order).

    6. Algorithms lower_bound, upper_bound

Get C++ How to Program, 10/e now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.