mercredi 27 novembre 2019

fast Algorithm to compare elements in array column-wise in JAVA

I have a multidimensional array of type int.

Example: c1 c2 c3 c4 r1 1 1 1 3 r2 2 2 3 3 r3 1 2 1 3

In here, I want to compare the corresponding elements of different columns. So elements on r1, for c1 are first compared with elements on r1 of c2, c3 and c4. Then elements of c2 for r1 will be compared against all other columns for r1.

After this, the same procedure is repeated for other rows.

Please suggest me a fast algorithm to do this. Mine one is using three loops to do this. And I want to reduce this complexity. Is it possible?

Let me know if the question is not clear.

Aucun commentaire:

Enregistrer un commentaire