dimanche 8 mars 2020

I am trying to compare two string sequences say SEQ1 with length 836 and SEQ2 with length 2301 in steps of 50 char's.Problem with border comparisons

That is 50 consecutive chars(each segment of 50 chars) of 1st SEQ are compared with 50 consecutive chars of 2nd SEQ(every segment of 50 chars).Now the problem is 1st SEQ last segment has 36 chars as length is 836 and last segment of 2nd SEQ has 1 char.I am planning to use two for loops for the iteration.How should I handle the border comparisons of two sequences whose segment sizes are not 50.

 void stringCompare()
{     
    int len = 0;
    for(size_t i =1; i<=836;i+=50)
    for(size_t j =1; j<=2301;j+=50)
    {
      len = max(sequenceOne.substr(i-1,50),sequenceTwo.substr(j-1,50));
      compareFun(sequenceOne.substr(i-1,50),sequenceTwo.substr(j-1,50),int H[2][len]);
    }
}

Aucun commentaire:

Enregistrer un commentaire