OK. I tried a few variations, and decided to add some randomization. I also changed the %order key scheme, though probably for the worse:
my %values; my %order; my %new_order; for (1..10) { my @l = get_values(20); print ">@l\n"; @values{@l} = (); for my $i ( 1 .. $#l ) { for my $j ( 0 .. $i-1 ) { $order{$l[$j]}{$l[$i]} = -1; $order{$l[$i]}{$l[$j]} = 1; } } } my @ordered = sort { $order{$a}{$b} or 0 } keys %values; print ">>@ordered\n"; exit; ############# sub get_values { my $k = shift; my @list; for my $i (1..$k) { push @list, $i if (rand > 0.6); } return @list; }
At 0.6, 10 runs, and a length of 20, I get about 50/50 good/bad results. (You could put together a better test case and plots stats for various values of the 3 inputs.)

My data has a very long sequence, hundreds of runs, and a very low threshold. If something is ambiguous, I have to pick a likely sequence anyway. (In some instances there is no single correct sequence, but several that vary in one or two positions...almost like DNA, but that's not what I'm working with.)

-QM
--
Quantum Mechanics: The dreams stuff is made of


In reply to Re^5: Reconstructing List Order From Partial Subsets by QM
in thread Reconstructing List Order From Partial Subsets by QM

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.