Questions tagged [bag]

An unordered collection that can contain duplicates

Contrast with the Set data structure.

Typically, a bag can count the number of a particular item that it contains. For example, 5 apples, 2 oranges, 1 banana.

164 questions
4
votes
0 answers

Failed to load WebView provider: No WebView installed on React Native Android

Good day! Every week my app crashes in the production mode on android devices. Basically it is happening on Xiaomi, Samsung, LGE phones with Android 10. Bug description: The app crashes in the production mode with an exception: Caused by…
jocoders
  • 1,594
  • 2
  • 19
  • 54
4
votes
4 answers

Simple way to count occurrences in array and get top values (bag of words)

Hi iv been looking around for a way to develop a simple bag of words type model in javascript and have spent time looking around at some examples, however most require jnode or browserify to be installed from what i have seen. I am trying to simply…
D3181
  • 2,037
  • 5
  • 19
  • 44
4
votes
1 answer

Type Casting through Composition (Interfaces and Classes)

I'm having a major disconnect when I'm attempting to use methods of classes (of which both classes implement interfaces) that also contain generics. I have a SetInterface interface which contains the methods for my Set class. The same is true for…
Pwrcdr87
  • 935
  • 3
  • 16
  • 36
4
votes
1 answer

How to update data in an ets bag?

ets:insert can be used to update data in an ets set, but how about a bag? Do we have to update by match_delete or select_delete first and then insert?
Ray
  • 83
  • 7
3
votes
4 answers

Objective-C implementation of a histogram or bag datastructure

Instead of implementing my own I was wondering if anyone knows of a histogram or bag datastructure implementation in Objective-C that I can use. Essentially a histogram is a hashmap of lists where the lists contain values that relate to their hash…
Michael Gaylord
  • 7,282
  • 8
  • 50
  • 47
3
votes
3 answers

How to find all combinations of a multiset in a string in linear time?

I am given a bag B (multiset) of characters with the size m and a string text S of size n. Is it possible to find all substrings that can be created by B (4!=24 combinations) in S in linear time O(n)? Example: S = abdcdbcdadcdcbbcadc (n=19) B = {b,…
3
votes
1 answer

Parallelizing list filtering

I have a list of items that I need to filter based on some conditions. I'm wondering whether Dask could do this filtering in parallel, as the list is very long (a few dozen million records). Basically, what I need to do is this: items = [ …
Victor
  • 1,163
  • 4
  • 25
  • 45
3
votes
3 answers

What is an efficient algorithm for extracting bags from lists of pairs?

I have a list of pairs of objects. Objects can appear in the pair in either order. What is the most efficient algorithm (and implementation?) to find all bags (ie sets with duplicates permitted) of pairs between the same objects. For my purpose the…
Chris Walton
  • 2,513
  • 3
  • 25
  • 39
3
votes
1 answer

How to avoid an empty result with `Bag.take(n)` when using dask?

Context: Dask documentation states clearly that Bag.take() will only collect from the first partition. However, when using a filter it can occur that the first partition is empty, while others are not. Question: Is it possible to use Bag.take() so…
JMann
  • 579
  • 4
  • 12
3
votes
1 answer

NHibernate child objects update

I have an object that called 'category' and the table looks like this. CATEGORY ------------------------------------------------- ID int ParentCatalogID int ParentCategoryID int << This is the ID of this table Position …
John
3
votes
2 answers

Duplicating all objects in an ArrayBag

I'm currently learning different DataStructures in Java, one being Array Bags and Linked Bags. I understand the reason why data structures are so important and how generics allow us to more easily handle objects in a uniform way, no matter their…
Pwrcdr87
  • 935
  • 3
  • 16
  • 36
3
votes
2 answers

remove & replace methods for java

So I am having alot of difficulty conceptualizing answers for the following questions. I am not looking for answers but rather useful steps that I can take that will enable me to present the answers on my own. Note: to answer these questions I am…
lisa spunky
  • 31
  • 1
  • 2
3
votes
1 answer

What's the difference between "Bag of Words" and "Bag of features" in computer vision?

Researching the subject, one can find papers where the author makes image classification / retrieval using the "Bag of Words" model, while others do similar tasks using a "Bag of features" model. Even though I have a basic understanding of the…
DanyAlejandro
  • 1,440
  • 13
  • 24
3
votes
1 answer

Union of two object bags in Java

I need help with a Java homework problem. I have two bags, say bag1 containing the strings A, B, C and D and bag2 containing strings E, F, G and H. I need to write a BagInterface for the union of those two bag then a class call ArrayBag
JavaStudent
  • 153
  • 1
  • 4
  • 13
3
votes
1 answer

get things out of bag in pig

In the pig example: A = LOAD 'student.txt' AS (name:chararray, term:chararray, gpa:float); DUMP A; (John,fl,3.9F) (John,wt,3.7F) (John,sp,4.0F) (John,sm,3.8F) (Mary,fl,3.8F) (Mary,wt,3.9F) (Mary,sp,4.0F) (Mary,sm,4.0F) B = GROUP A BY name; DUMP…
user398384
  • 1,124
  • 3
  • 14
  • 21
1
2
3
10 11