Fastest Way To Find Mismatch Positions Between Two Strings of the Same Length

前端 未结 9 1384
后悔当初
后悔当初 2020-12-28 22:08

I have a millions of pairs of string of same length which I want to compare and find the position where it has mismatches.

For example for each $str1 a

9条回答
  •  生来不讨喜
    2020-12-28 22:36

    I was going to say, "write it in C" too.

    Once there you can use optimization like comparing 4 characters at once (as 32-bit integers).

    Or change your representation (4-letter, right?) to use 2-bit to represent a base (?), so that you can compare 16 characters at once.

提交回复
热议问题