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
0 answers

Generating Subsets of a Multiset in Ascending Order of the Sums of the Elements of the Subset

I am trying to come up with an algorithm where you can generate combination from a set in a order such that their sums are in increasing order. This set has to be a multiset i.e. repetition allowed. For example you have a set S = {1,2,2,3,4,5,5} So,…
0
votes
0 answers

Multiset: Problem with multiset adding more than one version of a word and cannot handle large amounts of text

Update and fixed: I have fixed the problem causing the error message- Huge thanks to user PaulMcKenzie for helping me understand what the error message was telling me!- When my program encountered a letter with a mark above it (diacritical marks I…
RJWoods
  • 41
  • 1
  • 5
0
votes
2 answers

Is std::advance on an iterator of std::multiset done in constant time?

I would like to know if calling std::advance on an iterator of std::multiset is done in constant time.
Gautham
  • 766
  • 7
  • 15
0
votes
1 answer

Not working: override the default less-than operator of shared_ptr of a class

all. I'm trying to use a std::multiset to have automatic ordering upon insertion. Its elements are std::shared_ptrs to DataCell objects. Here is the code in the header file: #include #include #include #include…
Paulo Carvalho
  • 554
  • 5
  • 10
0
votes
0 answers

How do I randomly split a multiset into sets of predetermined sizes, without duplicates?

I'm looking for help on a problem which I don't know how to deal with. I'm guessing similar questions have already been asked, but I couldn't google it the right way. What I'm trying to do is a randomizer for the boards in FFXII in C# and there's a…
Doomberry
  • 11
  • 1
0
votes
2 answers

Multinomial sets

I'm having a problem figuring out this problem, it is similar to combining sets of non-unique letters, but is slightly different. Let k, m, and n be positive integers. We have nm balls, m colors, n balls, and k uniquely labeled bins. How many…
COner
  • 77
  • 1
  • 7
0
votes
1 answer

How to use find and erase in c++ multiset of pair

I wanted to store a pair of elements in a multiset and keep it sorted according to the first value stored in the pair. I made a comparator structure which helped me do this. But now i dont know how to use the multiset's find and erase functions.…
Aaron
  • 1
  • 1
0
votes
1 answer

Binary search to find less or equal value in STL C++ multiset

We have STL (Standard Template Library) multiset, we want to implement a binary search that will give us the first less-or-equal element compared to some value x From this post: lower_bound == upper_bound, we see that we can use the standar…
someone12321
  • 755
  • 5
  • 24
0
votes
0 answers

How to access particular element in a multiset in c++?

I wanted to find the median of a continuous stream of input and display it as values are input. I thought of using a multiset for this purpose as it will keep the input values sorted. using an iterator I am trying to find the median element which is…
0
votes
0 answers

Error when erasing element in multiset c++

I a class with a member variable, which is multiset < pair>>> m_oTrainGraphic; TrainType is enum. I am inserting some elements in the m_oTrainGraphic container.I have a method, which takes a parameter of type tm, and…
K.Krunk
  • 85
  • 1
  • 9
0
votes
2 answers

Leanest way to compute term frequency without using the counter class on a bag ADT

I have some code that works well computing term frequency on a chosen list using the counter class import. from collections import Counter terms=['the', 'fox', 'the', 'quick', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'] tf =…
Syntax Killer
  • 113
  • 2
  • 10
0
votes
0 answers

C++ multiset erase confusion

I am using a multiset to hold Building instances, and I want to order by building height (desc order), and using a lambda express to define it. This part seems ok. My confusion is about this line, buildings.erase(delta);, after this line is…
Lin Ma
  • 9,739
  • 32
  • 105
  • 175
0
votes
1 answer

No default selected row in DevExpress WinForms GridView in multiselect mode

I have a WinForms DevExpress GridControl with single simple gridview in multiselect mode. There is no default selected row when it displayed first time. In singleselect mode all works fine. GridControl obtains data for displaying via binding. May…
Pavel
  • 1
  • 1
  • 1
0
votes
0 answers

Set E type sizes equal to each other

How can I set the lengths (not the data as it has already been done) of the E type arrays, _size and arr.length equal to each other? Aliasing them does not work since I keep getting an OutOfBoundsException. _size is of length 16 and the length of…
Gintoki
  • 97
  • 1
  • 9
0
votes
1 answer

Overloading string operator for key multiset

I would like to overload possibly the string operator of my class so that I can count the number of element inserted into a std::multiset based on the key. I would like to get the total object of type "a" given the following class: class…
trexgris
  • 362
  • 3
  • 14