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

Haskell Multiset Operations

I am trying to create functions which can find the union and intersection of two multi sets in Haskell without the use of the Multiset module. I have a good understanding of basic intersections and unions in normal lists but multisets seem to throw…
user6040924
0
votes
2 answers

Custom comparison operator for custom struct in multiset C++

I have the following structure struct Node { int x0,y0,g,h,f; int *Grid[N][N]; Node* parent=NULL; Node(int x=0,int y=0,int G=0,Node* node=NULL) { x0=x; …
PhoenixDD
  • 121
  • 1
  • 2
  • 12
0
votes
1 answer

Iterate on a Multiset in Java, use setcount() without ConcurrentModificationException

Multiset ngrams = HashMultiset.create(); //added strings to the multiset... for (Entry entry : ngrams.entrySet()) { if (entry.getCount() > 3) { ngrams.setCount(terms, 3); } } Throws a…
seinecle
  • 10,118
  • 14
  • 61
  • 120
0
votes
2 answers

A persistent multiset that is built up sequentially and processed at once for Node.js

In Node.js I am trying to get the following behaviour: During the runtime of my Express application I accumulate several IDs of objects that need further processing. For further processing, I need to transmit these IDs to a different service. The…
Julian
  • 408
  • 5
  • 16
0
votes
1 answer

How does this code works ? ( multiset sorting )

struct compare{ bool operator() ( const string& a , const string& b ) const{ return a.size() < b.size (); } }; multiset stg; I was solving a question and i want to sort the multiset according to string length . I…
Rohit
  • 27
  • 5
0
votes
3 answers

Algorithm to check if two unsorted integer arrays have the same elements?

I'm still a newbie when it comes to programming in C so please be thorough in explanations. Also, this is a homework assignment so I would love it if you could help me solve this problem. I've looked around the site and could only find posts similar…
Cactus
  • 37
  • 5
0
votes
1 answer

CPP Primer 5ed. 15.8.1 multiset related

While reading Cpp Primer 5ed Chapter15.8.1 (page631), I am confused by the definition of private member - item. The original goes like: std::multiset, decltype(compare)*> items{compare}; Shouldn't this be…
0
votes
0 answers

How to chart multiple data sets in Excel mac 2011

I have the following data sets: City Temp Day LA 34 1 LA 33 2 SF 22 2 LA 24 3 SD 26 3 SD 27 4 SF 21 4 SF 19 5 LA 22 6 SD 28 6 LA 41 7 SD 29 8 SF 18 8 LA 33 10 SD 21 10 Requested Charts: X axis: Day Y axis:…
mbsf
  • 131
  • 1
  • 10
0
votes
1 answer

TypeError : update() takes from 1 to 2 positional arguments but 3 were given.

The Counter.update() function expects two arguments (data and its key) and I have provided two arguments but it complains of having provided three arguments. from collections import Counter InputString1 = input() InputString2 = input() Set1 =…
0
votes
1 answer

Oracle: ORA-00932 when using cast multiset

I have the following queries which work fine alone: SELECT COUNT(u.id) FROM users u); SELECT COUNT(s.id) FROM servers s); I want to use them in the same query, so I created this: SELECT CAST( MULTISET( SELECT count(u.id) FROM users u) …
Alexandru Severin
  • 6,021
  • 11
  • 48
  • 71
0
votes
1 answer

How to properly instantiate a MultiSet (created on my own) using Python

I wanted to learn about Data Structures so I decided to create them using Python. I first created a Singly Linked List (which consists of two classes: the actual List and the Node). A List consists of Nodes (or can be empty). Each node had a "next"…
SilentDev
  • 20,997
  • 28
  • 111
  • 214
0
votes
1 answer

Creating a Priority Queue via Multiset

I'm working on an assignment for class where we have to create a priority queue object using multiset. I pretty much know what to do, but I'm having a little trouble with the syntax of multiset. Here's my class definition for my priority…
Gwen Brewer
  • 87
  • 1
  • 6
0
votes
1 answer

guava - Multisets.copyHighestCountFirst method suddenly not working

I'm using guava Multiset library using their maven dependency version 18.0. I had a following code that used to work fine until a few weeks ago: ImmutableMultiset entryList = Multisets.copyHighestCountFirst(weightedDocs); which returns a…
pandagrammer
  • 841
  • 2
  • 12
  • 24
0
votes
2 answers

Find mode of a multiset in given time bound (most multiplicity)

The given problem: A multiset is a set in which some of the elements occur more then once (e.g. {a, f, b, b, e, c, b, g, a, i, b} is a multiset). The elements are drawn from a totally ordered set. Present an algorithm, when presented with a multiset…
0
votes
2 answers

C++ Set Erase Entry Question

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…
Wallace
  • 293
  • 1
  • 9
  • 18