Question: Can someone comment this algorithm and discuss the time complexity of this algorithm in terms of the size of the inputs X and Y? The

Can someone comment this algorithm and discuss the time complexity of this algorithm in terms of the size of the inputs X and Y?

The algorithm takes two 2-Dimensional arrays which represents the black and white images. The algorithm compares the two arrays and declares that the images are similar or not.

This algorithm compares each row in the two 2 dimensional arrays and computes the difference of each row. The algorithm finds the minimum difference of each row and stores it in a separate variable. Finally, the algorithm aggregates the minimum difference of each row. The algorithm outputs Images are different if the total difference is greater than threshold value else it outputs Images are similar.

The pseudocode for the algorithm Compareimages is as follows:

Can someone comment this algorithm and discuss the time complexity of this

Can someone comment this algorithm and discuss the time complexity of this algorithm in terms of the size of the inputs X and Y?

void compareimages (int x[M] [N], int y[M] [N], int thresh) { for (int a = 0; a = 0 && ()-1) >= 0) { if (X[a][i] y[a][j]) { D[i][j] D[i 1] [j - 1]; } else { D[i][j] = D[i - 1] [j - 1]+1; } if ((i-1) >= 0) { D[i][j] = minimum (D[i][j], D[i-1] [j]+1); } if ((j-1) >= 0) { D[i][j] = minimum (D[i][j], D[i][j-1]+1); } } } int Aggregate = 0; int min_diff = INT_MAX; for (int b = 0; b thresh) { cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!