Reputation
418
Top tag
Next privilege 500 Rep.
Access review queues
Badges
3 8
Newest
 Scholar
Impact
~1k people reached

  • 0 posts edited
  • 0 helpful flags
  • 6 votes cast
Feb
26
comment Algorithm to find minimal set
I've ended up with a variation of your suggestion for the approximation which, for the sample inputs I've used, yields similar (often slightly smaller) results and is easier to implement efficiently. Sort $S$ by cardinality (lowest to highest), then for each set left in $S$ pick the element that is in the most other sets, then remove all sets from $S$ that include that element. res = []; s.sort_by! &:length; while !s.empty?; r = s.shift.max_by {|x| s.count {|i| i.include? x}}; res << r; s.delete_if {|i| i.include? r}; end;
Feb
26
awarded  Scholar
Feb
26
accepted Algorithm to find minimal set
Feb
26
awarded  Student
Feb
26
comment Algorithm to find minimal set
@ne2dmar It was indeed wrong. Last minute I modified it to try and get a single solution to M, but screwed it up. I have updated it now.
Feb
26
revised Algorithm to find minimal set
added 39 characters in body
Feb
26
asked Algorithm to find minimal set
Feb
26
awarded  Informed
Aug
23
awarded  Yearling
Mar
6
awarded  Yearling
Jun
26
comment Why should one want to disable compiler warnings?
@Mahmoud oh, I love generics, but type erasure means it can't verify as much as, say C#. Which means when I try and do some of the things I'm used to, I end up having to ignore warnings about unchecked code.
Jun
26
awarded  Editor
Jun
26
revised Why should one want to disable compiler warnings?
deleted 8 characters in body
Jun
26
comment Why should one want to disable compiler warnings?
@Mahmoud I very often find myself having to surpress "unchecked" warnings when doing anything even remotely complex with generics. But it's probably unfair to lump Java in with C++ on the ridiculous warnings front - edited my answer.
Jun
24
answered Why should one want to disable compiler warnings?
Mar
29
comment Most common “Y2K-style” bugs today?
Surely as an initial guess it's a good start, so long as it's easy to correct when it gets it wrong.
Jan
7
awarded  Good Answer
Jan
7
awarded  Nice Answer
Jan
7
awarded  Teacher
Sep
10
awarded  Autobiographer