473,508 Members | 2,396 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sequential and Associative containers

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.

Mar 12 '06 #1
2 5732
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...
Mar 12 '06 #2
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.
Mar 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2370
by: Ney André de Mello Zunino | last post by:
Hello. A non-modifying algorithm I implemented uses two associative containers from STL: set and map. The elements on those containers are supposed to refer to actual elements which lie on...
1
1502
by: Neil Zanella | last post by:
Hello, I would like to know what the exact requirements are for classes that use associative containers in terms of which overloaded operators and constructors they must provide. For instance,...
1
1348
by: Dave | last post by:
Hello all, Why is the term "associative" containter used to describe std::set<>, std::map<>, std::multiset<> and std::multimap<>? I always had the impression that it is related to the fact that...
7
1689
by: Matthias Käppler | last post by:
Hi, I have the following problem: I want to store file objects in a container 8for now, it's not important how they look like). Now, on the one hand I need to be able to randomly pick files...
1
1787
by: yonil | last post by:
I hope this is the correct group for this... I'm currently implementing the TR1 associative containers according to specification found in...
5
1859
by: desktop | last post by:
set, map, multiset and multimap are all associative containers. But what does the word "associative" have to do with these 4 containers?
3
1527
by: subramanian100in | last post by:
I am copying the following lines as it is, from Stanley Lippman's C++ Primer 4th edition, page 418(First paragraph). It says: "Although the map and set types provide bidirectional iterators, we...
4
1573
by: Morten | last post by:
Hi. Is there anybody who knows a C (not c++) library containing implementations of associative containers (stack, queue, hash table, linked list). It would be great if the performance of...
1
1235
by: anonymous | last post by:
I have a function that returns a map<string, vector<int. Inside the function I load the map with this instruction: loc_map.push_back(1); I would like to remove the output data structure and to...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5049
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.