In article <11**********************@i39g2000cwa.googlegroups .com>,
"utab" <um********@gmail.com> wrote:
Hi there,
Can you please explain me why there are sequential and associative
containers in c++ on some examples and briefly specify the advantages
of using one over the other(and also from the point of performance as
well, I know that it is hard to answer because this is dependent on the
application that you would like to develop :-)) )
Thanks for all comments in advance.
<http://www.sgi.com/tech/stl/AssociativeContainer.html>
[An Associative Container] differs from a Sequence in that it does not
provide a mechanism for inserting an element at a specific position.
Complexity guarantees
* Average complexity for erase key is at most O(log(size()) + count(k)).
* Average complexity for erase element is constant time.
* Average complexity for erase range is at most O(log(size()) + N),
where N is the number of elements in the range.
* Average complexity for count is at most O(log(size()) + count(k)).
* Average complexity for find is at most logarithmic.
* Average complexity for equal range is at most logarithmic.
Models
* set
* multiset
* map
* multimap
<http://www.sgi.com/tech/stl/Sequence.html>
Complexity guarantees
* The fill constructor, default fill constructor, and range constructor
are linear.
* Front is amortized constant time.
* Fill insert, range insert, and range erase are linear.
* The complexities of single-element insert and erase are sequence
dependent.
Models
* vector
* deque
* list
--
Magic depends on tradition and belief. It does not welcome observation,
nor does it profit by experiment. On the other hand, science is based
on experience; it is open to correction by observation and experiment.