No, it doesn’t. The STL algorithm copy_backward() reverses the order in which elements are copied but not the order in which elements are stored; that is, it starts with the end of the range and reaches the top. To reverse the contents of a collection, you should use std::reverse().
std::sort() can be used on a list in the same way it can be used on any sequential container. However, the list needs to maintain a special property that an operation on the list does not invalidate existing iterators—a property that std::sort() cannot guarantee to upkeep. So, for this reason, STL list supplies the sort() algorithm in the form of the member function list::sort(), which should be used because it guarantees that iterators to elements in the list are not invalidated even if their relative positions in the list have changed.
These functions supply the first and the last positions, respectively, where an element can be inserted into a sorted collection without disturbing the sort.
No, for this would contradict the purpose of a stack, which is supposed to be a last-in-first-out container.
The queue does not feature iterators, and elements in a queue can be accessed only at its ends.
STL algorithms work using iterators. Because neither the stack nor the queue class supplies iterators that mark the end of the ranges, the use of STL algorithms with these containers would not be possible.
The bitset, as it is most suited to this requirement.
bitset::count() supplies the number of bits at value 1. This number, when subtracted from bitset::size() (which indicates the total number of bits stored), would give you the number of 0s in the sequence.
Yes. Because the vector<bool> is a partial specialization of the std::vector, iterators are supported.
Yes, by either specifying the number in the overloaded constructor or using vector<bool>::resize() function at a later instance.