Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Edit:</strong> Completely new algorithm.</p> <p>It seems to me like your notion of "disorder" corresponds to how readable the scrambled string is compared to the original. A decent measure of readability would be to find unscrambled substrings and then see what the overall order of the substrings is.</p> <ol> <li>Find all of the substrings of the scrambled string of maximal length that match the original string and store them in an array in the order found. Note: since each letter only appears once, the substrings will be disjoint.</li> <li>Let the "fragmentation score" be the number of maximal substrings.</li> <li>Let the "continuity score" be the sum of the squares of the lengths of the substrings.</li> <li>For each substring, score it by comparing it to the overall order of the substrings (add up how many precede it that should and how many follow it that should). Let the string's "order score" be the sum of all of the scores of the substrings.</li> <li>We now have a three-dimensional score. Compare strings by first comparing fragmentation score, if they are equal compare continuity score, if they are equal compare order score. Lower fragmentation scores are less scrambled, higher continuity and order scores are less scrambled.</li> </ol> <p>Example: "acpehz" has frag, cont, and order scores 3, 12, 4.</p> <p>By this method, we have "peachz" &lt; "eachzp" &lt; "pahezc", as desired.</p> <p>The only obvious limitations I can think of for this algorithm are that it's probably going to be very slow and "eachzp" is less scrambled than "pezach" even though you might think of them as equal since "only one letter is out of order".</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload