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").

7 votes
2 answers
920 views

Container for Sets of Integers

I implemented an unordered_set like container for storing small sets of unsigned integers. It uses a trivial hash table for lookups and an unordered array for quickly iterating over small sets. I'm ...
Bob65536's user avatar
  • 862
8 votes
2 answers
4k views

Is there a better way to insert an enum into a set without macros?

I created an enum for a class and in the constructor I inserted all the enum values into a set. I am wondering if there is a ...
Aaron's user avatar
  • 955
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
3 votes
4 answers
49k views

Find the uncommon elements from two sets

I am trying to find the uncommon elements from two sets in Java. Here is my way: ...
srk's user avatar
  • 608
26 votes
6 answers
3k views

HashSet and TreeSet

I got some homework in which I had to take the novel War and Peace and put it into a HashSet and TreeSet respectively. I had to time it, to check differences and my question is whether my ...
OmniOwl's user avatar
  • 445

15 30 50 per page
1
6 7 8 9
10