Questions tagged [multiset]

Anything related to multisets (a.k.a. bags), i.e. data structures that are generalizations of sets and in which an element can be present more than once. This tag applies to questions about multisets implementations, regardless of the specific programming language involved.

Anything related to multisets (a.k.a. bags), i.e. data structures that are generalizations of sets and in which an element can be present more than once. This tag applies to questions about multisets implementations, regardless of the specific programming language involved.

See Wikipedia page on multisets.

344 questions
0
votes
1 answer

Multiset of pair, find

I need to find and erase a value in mutliset of pair sorted by my own function. Apparently, .find always returns the iterator to the end, not to the searched value. Any tips? This is the function : struct cmp { bool operator() (const para &a,…
Muco
  • 27
  • 9
0
votes
0 answers

ML small coding error

I'm working in CPN ML, which is more or less the same as SML. I know for sure that the following part of code works: color Product = string; color Number = int; color StockItem = record prod:Product * number:Number; color Stock = list StockItem;…
JonasB
  • 1
  • 1
0
votes
2 answers

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…
Sarah
  • 1,614
  • 1
  • 23
  • 37
0
votes
1 answer

Using a member of a type as a key in std::multiset

I am creating my own tree-like container in C++. Here is an outline of how I imagine it's structure: //========================================================== // Concept //========================================================== // // RootNode…
OMGtechy
  • 7,935
  • 8
  • 48
  • 83
0
votes
2 answers

C++ - Make a string+int set stl type

my question is: is it possible to create a multitype stl set? If a want to calculate the occurrences number from a text file, how can I do? I need to use only or ... #include #include #include #include…
user3827443
0
votes
3 answers

Efficient way to convert multiset to set

Is there an efficient way to convert multiset to set, instead of loop all elements in multimap, test if set has the element, if yes insert if not continue? For multiset and set, I prefer using stock C++ containers, but other language implementation…
Jun
  • 171
  • 4
  • 16
0
votes
1 answer

Converting a MultiSet object to object array

I am working on collections of generic arraysE[]. I'm currently stuck on the union of two sets and trying to convert a MultiSet aSet into a generic array. I'm trying to compare the generic array of the current class, or the 'this' array, to the…
Benjamin Z
  • 7
  • 1
  • 3
0
votes
1 answer

Guava ImmutableSortedMultiset: how to "sum" two instances?

I am trying to merge, or "sum", two SortedMultiset into one. However, in the Multisets class, there is no such method. I would like to do something like: // this is just an example, the actual sets would be created differently (they are NOT…
Giovanni Botta
  • 9,626
  • 5
  • 51
  • 94
0
votes
1 answer

Standard way of implementing a multiset?

I am looking for a standard way to implement a multiset (a "bag") in MySQL. The values this multiset may contain are strings only. The reason behind it is counting; I have a list of events, which I cannot predefine, and I wish to count their…
Bach
  • 6,145
  • 7
  • 36
  • 61
0
votes
0 answers

multiset object isn't sorting strings inserted

I'm using a multiset object to sort a group of strings that I'm passing into it(using the default alphabetical ordering that it provides). My issue is that it is not sorting the strings like it is supposed to. I know it should work because I was…
Otto45
  • 555
  • 2
  • 6
  • 20
0
votes
1 answer

Most efficient way to remove unique keys from python's Counter() multiset dictionary

I find the Counter() function in python very useful, and it has a built-in Counter.most_common() function to return the keys in order of most to least common. But I haven't found a build_in function to filter out all keys that are unique, or…
Marc Maxmeister
  • 4,191
  • 4
  • 40
  • 54
0
votes
1 answer

Runtime of inserting into multi set

What is the overall runtime of inserting into a multi set, lets say I am going over a billion elements and inserting into multi-set, which maintains a sorted ordering. What is my worst case runtime?
AyBayBay
  • 1,726
  • 4
  • 18
  • 37
0
votes
1 answer

Set vs. Multiset

I'd like to store (about 100 to 1000) different relations of type in a set or multiset. I'd like to be able to search for A and (A,R), but not for (A,R,B) (and there will be only a few (<5) relations with the same A…
Ragnar
  • 434
  • 7
  • 16
0
votes
2 answers

Convert String to HashMap/MultiSet?

What is the best way to convert a long string to a data structure with words and counts. I would do .split(" ") to split on spaces and presumably make an arraylist, then maybe go through arraylist and add each item to a hashmap or multiset? I'm not…
LemonMan
  • 2,963
  • 8
  • 24
  • 34
0
votes
0 answers

Writing a birthday calendar with a multiset of birthday objects but sorting isn't working

I am writing a birthday calendar with a multiset of birthday objects. My comparison function isn't sorting right and I can't search for a b-day by name. class CompareName { public: bool operator()(Birthday* a,Birthday *b) { …
AlexGimson
  • 19
  • 8