CISP 400 - Chapter 15 Standard Library
Containers and Iterators
An STL algorithm cannot:
Be used with containers that support more powerful iterators than the minimum
requirements for the algorithm.
Return an iterator.
Access STL members directly.
Take two iterators as arguments to specify a range. - ANSWER-
Attributes of a heap do not include:
- A preference to pop, rather than push, elements in the heap.
- Having a binary-tree structure.
- The children of a given node are less than or equal to the parent node's value.
- Having the largest element at the top of the heap. - ANSWER-
Class deque provides:
- The ability to add storage at either end of the deque.
*- All of the above.
- Efficient indexed access to its elements.
- Efficient insertion and deletion operations at the front and back of a deque. -
ANSWER-
Data loss could occur if the contents of a __________ were placed into any of the other
three associative container types.
*- multimap.
- map.
- multiset.
- set. - ANSWER-
Function objects have their functions called by using:
- The arrow operator (->).
- The binary scope resolution operator (::).
*- operator().
- The dot operator (.). - ANSWER-
Functions iter_swap and swap_ranges are similar in that both:
*- Take forward iterators as arguments.
- Swap a range of elements
- Take two arguments.
- Can only swap elements within the same array or container. - ANSWER-
Functions lower_bound, upper_bound and equal_range are different in their:
- First argument types.