0

I am developing a programme about string analyses. I've done levensthein distance algorithm but it is just applicable for two strings. Now, I want to run more strings than two, concurrently. Like, from text file;

S1 : "0123412315",
S2 : "324153243",
S3 : "12354244",
S[n] : "......."

So, Firstly, it has to calculate between S1 and S2 then S1 and S3, S2 and S3 and so on, respectively. Do you have any idea about this ? I mean, I don't want to any code. Let me know pseudo-code or implementation of this part. Thanks in advance.

Ugur Ç.
  • 3
  • 6
  • 1
    Create a threadpool and let a given number of threads work on your array and do your calculations. – user743414 May 24 '18 at 20:05
  • @user743414 sorry,it is my grammer mistake. Actually it doesnt has to be concurrent. It can move step-by-step. After calculating first distance, it follows another distance. Does it matter ? – Ugur Ç. May 24 '18 at 20:24
  • So then what's your problem in doing so? Take a while or a for loop. – user743414 May 25 '18 at 08:32
  • @user743414 sorry for late. My implementation of code is below as answer. – Ugur Ç. May 26 '18 at 12:24

1 Answers1

0
int main(){
    int dp[3][3];
    string A,B;
    string array[] = {"axd","byd","axd"};
    for (int i = 0 ; i < 3; i++){
        A = array[i];

        for (int j = 0; j<3; j++){
            B = array [j];
            if(A[i] == B[j]){
                dp[i][j] =1;
                cout << dp[i][j] << endl;
            }else
                dp[i][j] = 0;
        }
    }
    for(int i = 0; i<3; i++){
        for(int j = 0; j<3; j++){
            //cout << dp[i][j];
        }

        //cout << endl;
    }
    return 0;
}

I'll pull them from text file like string array,which is like below, and I'll let them order. Firstly, A is axd B is byd, A is byd, B is axd, respectively. Then I'll put their results into matrix using algorithms. Am i right ?

Ugur Ç.
  • 3
  • 6