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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.