Hi,
Guys i just wanted to know whether set store elements in specific order or it contains unordered elements only. As per c++ specification
http://www.cplusplus.com/reference/set/set/?kw=set
Sets are containers that store unique elements following a specific order.
As per my knowledge they are not ordered in the sense that you can't enforce an arbitrary order by placing an arbitrary element in an arbitrary position. it is usually implemented as a red-black tree and i believe due to this it is not possible to place and arbitrary element in an arbitrary position. In java the Set interface does not provide any ordering guarantees.
can-mohan
0
Junior Poster
Recommended Answers
Jump to PostAs you say, in Java Set is an interface for Collections with no duplicates but no information about ordering, so that's completely different from C++ sets which are weakly ordered. (The Java SortedSet interface is one that has ordered elements.) However, some of the Java concrete classes that implement Set …
All 4 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
tinstaafl
1,176
Posting Maven
can-mohan
0
Junior Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.