multiset

Java: get a unique property of an object (like hashcode, but collision proof)

I have a task for which it is necessary to generate a unique value for every object in a set. using the hashcode would be perfect, if collisions weren't allowed in the hashcode contract. One idea: Record every object's hashcode into a multiset. Then, use hashcodes as the unique identifier, but if that hashcode is in the set more than o...

Can you encode to less bits when you don't need to preserve order?

Say you have a List of 32-bit Integers and the same collection of 32-bit Integers in a Multiset (a set that allows duplicate members) Since Sets don't preserve order but List do, does this mean we can encode a Multiset in less bits than the List? If so how would you encode the Multiset? If this is true what other examples are there wh...

Are there any implementations of multiset for .Net?

I'm looking for a .Net implementation of a multiset. Can anyone recommend a good one? (A multiset, or bag, is a set that can have duplicate values, and on which you can do set operations: intersection, difference, etc. A shopping cart for instance could be thought of as a multiset because you can have multiple occurrences of the same pr...

Coordinating typedefs and structs in std::multiset (C++)

I'm not a professional programmer, so please don't hesitate to state the obvious. My goal is to use a std::multiset container (typedef EventMultiSet) called currentEvents to organize a list of structs, of type Event, and to have members of class Host occasionally add new Event structs to currentEvents. The structs are supposed to be sor...

Multiset container appears to stop sorting

I would appreciate help debugging some strange behavior by a multiset container. Occasionally, the container appears to stop sorting. This is an infrequent error, apparent in only some simulations after a long time, and I'm short on ideas. (I'm an amateur programmer--suggestions of all kinds are welcome.) My container is a std::multiset...

C++ Set Erase Entry Question

Hi. I encountered a problem here. I'm using C++ multiset. This is the test file. Score: 3-1 Ben Steven Score: 1-0 Ben Score: 0-0 Score: 1-1 Cole Score: 1-2 Ben I'm using while loop and ifstream (fin1) to read in from the test file above. multiset<string, less<string> > myset; while(!fin1.eof()) { fin1 >> scoreName; if(scoreName...

multiset & multimap - What's the point?

As the question states ... i don't get the point about multisets / multimaps. So, what's the purpose? ...

Find top N elements in a Multiset from Google Collections?

A Google Collections Multiset is a set of elements each of which has a count (i.e. may be present multiple times). I can't tell you how many times I want to do the following Make a histogram (exactly Multiset) Get the top N elements by count from the histogram Examples: top 10 URLs (by # times mentioned), top 10 tags (by # times app...

Oracle multiset, collection and records

Can anybody Explain me why records are required. Can't we perform the same operation in pl/sql using loop and all. Also when multiset, records query can be used i.e. in which type of situation and which one will be the preference. ...

Is there an algorithm to generate all unique circular permutations of a multiset?

I encountered this problem when doing some enthusiastic programming. The problem can be expressed as follows: For a multiset A, let P(A) denote the set of all possible permutations of A. P(A) is naturally divided into disjoint subsets that are equivalence classes, with the equivalence relation being "can be related by circ...

Ensure multiset is reordered when objects change

I have a multiset with a custom predicate function, e.g multiset<MyClass *,MyCompFunc> where MyCompFunc looks at an attribute on the MyClass objects. During the progress of the application, the objects might change in a way that should cause them to be reordered. What's the correct way to get the multiset to become reordered when this h...

How to do binary search in a std::multiset without constructing a key_type object?

I have a container like this: // Sort functor struct SortByTime : std::binary_function<const TimeSortableData &, const TimeSortableData &, bool> { bool operator()(const TimeSortableData & a, const TimeSortableData & b) const { return a.GetTime() < b.GetTime(); } }; // Container that sorts by time typedef std::mult...

GCC Tree STL data containers

Possible Duplicate: remove_if equivalent for std::map Yesterday i wrote a program, which use multiset for storing elements like this: std::multiset < boost::shared_ptr < CEntity > > m_Entities; Then i try to use standard algorithm remove_if like this: std::remove_if(m_Entities.begin, m_Entities.end(), MarkedForDestroy); ...