Skip to main content

Questions tagged [set]

A set is a collection in which no element is repeated, which may be able to enumerate its elements according to an ordering criterion (an "ordered set") or retain no order (an "unordered set").

2 votes
1 answer
334 views

Countable and uncountable sets in .NET (clean version)

Sorry, it used to be some retired garbage in Countable and uncountable sets. Now and here it is clean. P.S. I would not like to say that this stuff is about to replace functional programming :) No, ...
Dmitry Nogin's user avatar
  • 6,131
3 votes
2 answers
622 views

Countable and uncountable sets in .NET (IEnumerable and Predicate)

There is a full featured support of countable sets in .NET: IEnumerable<T>. What about uncountable sets; sets defined by predicate? How can they be ...
Dmitry Nogin's user avatar
  • 6,131
1 vote
0 answers
79 views

A simple Java integer hash set - follow-up

(See the previous version.) (See the next version.) After incorporating changes in the previous post, I came up with this implementation. However, I left hashing as it is. ...
coderodde's user avatar
  • 28.9k
10 votes
2 answers
2k views

boost::unordered_set intersection using templates

I wrote this function to do unordered_set intersection using templates. I have seen this answer but I thought that it was overkill. I would like the method to take ...
pbible's user avatar
  • 419
7 votes
4 answers
3k views

Faster Way of Comparing Generic Sets

The following extension method is the limiting factor in the performance of an application I am developing, according to Visual Studio 2012 Performance Analysis profiler. Is there a faster way to ...
Chris Shouts's user avatar
6 votes
4 answers
1k views

A simple Java integer hash set

(See the next version.) The following data structure implements a hash table based set for int values: ...
coderodde's user avatar
  • 28.9k
6 votes
4 answers
1k views

Monty hall python simulation

I have the following code that simulates the monty hall problem (see google for more details). I used sets to do it but is there a more intuitive or efficient way to do it? ...
user3079275's user avatar
6 votes
1 answer
3k views

UnionFind implementation

The Wikipedia article on the union find problem gives a very simple implementation, which I ported to C# and tested. I know that the code should be, in the aggregate, asymptotically almost linear. ...
Craig Gidney's user avatar
5 votes
1 answer
245 views

Finding added keys, removed keys, and unchanged keys in ordereddict

I'm comparing two OrderedDict objects and I need to find added keys, removed keys, and keys that are present in both (the intersection). Sets are designed for ...
Conor Mancone's user avatar
5 votes
2 answers
763 views

Filtering a List based on a Suffix and avoid duplicates

I was wondering if there is a better way to solve this issue. I have a list like this: ...
Andrea Ciufo's user avatar
4 votes
1 answer
3k views

List union implementation

I'm trying to implement union from the standard Data.List library. I know it's reinventing the wheel, but reimplementing ...
dopatraman's user avatar
3 votes
1 answer
112 views

Improving Speeds of Tokenisation of large word list for distinct combinations

I'm having trouble with a current algorithm I'm writing that takes a corpa, a list of characters in sets (1 one or larger) with a frequency number attached to it. Against another list of character ...
thomascrha's user avatar
3 votes
1 answer
1k views

Calculate pairs in a Set ("Sherlock and Pairs" HackerRank challenge)

I have started reading clean code and want to improve my coding practices. Here is my attempt at solving an online puzzle. Please review the code and let me know how could I have written it better in ...
Posiedon's user avatar
2 votes
1 answer
683 views

Haskell union list implementation pt 2

This is my revision from another post ...
dopatraman's user avatar
2 votes
1 answer
311 views

IEnumerable and Predicate sets in .NET

GitHub Repository Previously: Countable and uncountable sets in .NET (clean version). Thesis There is a full featured support of countable sets in .NET: ...
Dmitry Nogin's user avatar
  • 6,131

15 30 50 per page