From: Rob Biedenharn Date: 2009-11-24T01:10:29+09:00 Subject: Re: Distinct Sets (#225) On Nov 22, 2009, at 1:51 AM, lith wrote: >> http://gist.github.com/240457 > > Both of your tests use rather small input sets. It would be > interesting to know how the solutions deal with input that contains > many (10, 50, 100, ....) sets and/or many different signs (not just > letters). I accept your challenge! The gist has been updated with sets that use numbers and symbols as well as strings. There are also some tests of large sets (which worked fine, but getting the test setup by hand was nasty). ruby -rubygems distinct_sets_test.rb Loaded suite distinct_sets_test Started .......................... Finished in 1.237836 seconds. 26 tests, 202 assertions, 0 failures, 0 errors The only change that I has to make was in how I sorted the final array to account for symbols or mixed contents: Numerics compare "naturally" with <=> and non-numeric or mixed are compared using the #to_s representation. -Rob P.S. I could add my solution to the gist, too, but I'll give everyone a chance to try the new tests first. Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com