in reply to Re: (Golf challenge) (to cover my embarassment!)
in thread Stable mixing of 2 arrays into a 3rd
More seriously, if we add the contraint of both lists having the same size in the second problem, all we need to do is to enumerate all binary numbers from zero to 2 ** size of one of the lists. A zero numeral means take from t1, a one means take from t2. This is pretty fast.
Now to extend it for differently sized lists, you can just do the same but kill disqualifying members later. Probably no longer fastest, but the code would be golf fodder.
Update: That's all wrong, as BrowserUk points out.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Several simple (simplistic?) notes
by BrowserUk (Patriarch) on Oct 02, 2004 at 08:03 UTC | |
by gaal (Parson) on Oct 02, 2004 at 08:54 UTC |