Note that there are some explanatory texts on larger screens.

plurals
  1. POAlgorithm for disorder of strings regarding substring sequences and order (strings of same length, same chars, unique chars, no lexical meaning)
    primarykey
    data
    text
    <p>Let's say I have "peachz" as a string, and "eachzp" and "pahezc" as attempts used for comparison.</p> <p>I'm looking for an algorithm that outputs the level of disorder of the array, regarding the relative order of the occurrences. In the following example I describe the problem with my current algorithm. I'm summing up the differences in the attempt position of each character against the ones on the original string.</p> <p>Here's an example image:<br> <a href="http://i51.tinypic.com/1zz2c10.png" rel="nofollow noreferrer">http://i51.tinypic.com/1zz2c10.png http://i51.tinypic.com/1zz2c10.png</a></p> <p>"eachzp" has the same order of characters, except for the P. Because P has moved to the first position, every other character is seen as being one position out of place. "eachzp" will output a disorder degree of 10, while the totally scrambled "pahezc" attempt will output 8. This is incorrect. Things like Hamming or Levenshtein distance do not take these "order sequences" into account either.</p> <p>My question is: Is there an algorithm I can use to output the disorder/similarity of the strings, considering the relative order of their characters? </p> <p>(This should not be dictionary-related, since the strings aren't words and do not have any lexical meaning. If it helps, characters will are also be unique on each string.)</p> <p>tia</p> <p>/edit: I'll try to explain my situation in a different way, trying to further detail it:</p> <ul> <li><p>The strings are always of the same length</p></li> <li><p>The strings have always the same chars (eg. if the original were "ors", other strings could only be "ors", "osr", "sor", "ros", "sro" or "rso" - same length and same chars)</p></li> <li><p>The chars are always unique on each string</p></li> <li><p>The strings are not words and have no lexical meaning at all</p></li> <li><p>I need the algorithm to take the order sequence into account. If the original string is "peachz", "eachzp" is ordered almost exactly in the same way - only "p" is out of place. This should be more similar to "peachz" than "pahezc", that is much more scrambled, and in all directions (i feel this "direction" notion could be relevant to the solution).</p></li> <li><p>"eapchz" should also be less scrambled than "eachzp". On both situations only the letter "p" is out of place, but it has moved a shorter distance on "eapchz". </p></li> </ul> <p>All help is appreciated. thanks</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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