Talk:Best shuffle: Difference between revisions

Content added Content deleted
Line 167: Line 167:
::hmm, that's an interesting interpretation, supported by the fact that random is an option, but it would make this task even more like the permutation tasks where all permutations need to be generated.
::hmm, that's an interesting interpretation, supported by the fact that random is an option, but it would make this task even more like the permutation tasks where all permutations need to be generated.
:::''You do not actually have to generate all solutions for this. For example, let's say that you have an algorithm which works by building lists of instances of each letter as its first step. Let's also suppose that this algorithm only finds one solution. If you then randomly shuffle each of those lists of character locations, your result could then be a random pick from the potential best results (for the cases where more than one solution is possible). --[[User:Rdm|Rdm]] 13:00, 14 October 2011 (UTC)''
:::''You do not actually have to generate all solutions for this. For example, let's say that you have an algorithm which works by building lists of instances of each letter as its first step. Let's also suppose that this algorithm only finds one solution. If you then randomly shuffle each of those lists of character locations, your result could then be a random pick from the potential best results (for the cases where more than one solution is possible). --[[User:Rdm|Rdm]] 13:00, 14 October 2011 (UTC)''
::::i looked at the description of the C solution (but i didn't study the code), and i don't quite understand how this is supposed to work.

::::it splits the input into sets, starting a new set when a letter is already in a set, so for abracadabra this would produce ((a b r) (a c) (a d) (a b r) (a)), but that is not right, to make it work the sets should be: ((a b r) (a c) (a d) (a b) (r a)). there is also talk about putting the longest set first, but i don't understand how it prevents a letter from falling into the same place as the input if sets are reordered.--[[User:EMBee|eMBee]] 14:39, 14 October 2011 (UTC)
<del>
<del>
i posted a function for generating a random permutation as per the task description, and am still working on comparing the results.
i posted a function for generating a random permutation as per the task description, and am still working on comparing the results.