function - Java boolean isSymmetric -
For now I have to write a java boolean, the simetric () fusion that returns right if the incotting matrix is a symmetrical matrix; Otherwise it is wrong, can anyone help me start with the code here or where? Any answer would be appreciated.
All you need is Google. There were so many replies.
But all you have to do is that if (A, B) is equal (B, A). Public static boolean symmetric (int [] [] array) {for (int a = 0; a & lt; array.length; a ++) {for (int b = 0; b & lt; array.length; b ++) {if (array [one] [b]! = array [b] [a]) {return false; }}} Be true; }
In this method goes through the outermost lines for the loop and the loop is going through the internal column.
You have to go through each element in the matrix. If the array [A] [B] == array [B] [A] then you can check the next one. If they are not identical then this matrix is not symmetric.
Comments
Post a Comment