Sequential and Associative containers

Discussion in 'C++' started by utab, Mar 12, 2006.

  1. utab

    utab Guest

    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.
     
    utab, Mar 12, 2006
    #1
    1. Advertising

  2. utab

    Ben Pope Guest

    utab 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 :)) )


    What book are you reading that does not explain the differences between
    containers and their associated performance characteristics?

    I have "Effective STL" by Scott Meyers, and that has good descriptions.

    Ben Pope
    --
    I'm not just a number. To many, I'm known as a string...
     
    Ben Pope, Mar 12, 2006
    #2
    1. Advertising

  3. utab

    Daniel T. Guest

    In article <>,
    "utab" <> 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.
     
    Daniel T., Mar 12, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?=

    Iterators as associative containers' key

    =?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?=, Jun 26, 2003, in forum: C++
    Replies:
    2
    Views:
    771
    =?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?=
    Jun 26, 2003
  2. Dave
    Replies:
    3
    Views:
    395
    Kevin Goodsell
    Apr 19, 2004
  3. desktop
    Replies:
    5
    Views:
    387
    James Kanze
    Jun 26, 2007
  4. , India
    Replies:
    2
    Views:
    342
  5. anonymous
    Replies:
    1
    Views:
    292
    James Kanze
    Aug 2, 2008
Loading...

Share This Page