-
-
Save Shubhra22/20d170de0b52d4e25aecdeed3dbd2e94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write a method | |
public static int max(int[][] a) | |
that returns the maximum value in the 2d parameter array a. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write a method | |
public static int rowSum(int[][] a, int x) | |
that returns the sum of the elements in Row x of a. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int columnSum(int[][] a, int x) | |
that returns the sum of the elements in Column x of a (careful with rows of different lengths!). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write a method | |
public static int[] allRowSums(int[][] a) | |
that calculates the row sum for every row and returns each of the values in an array. Index i of the return array contains the sum of elements in row i. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write a method | |
public static boolean isRowMagic(int[][] a) | |
that checks if the array is row-magic (this means that every row has the same row sum). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write a method | |
public static boolean isColumnMagic(int[][] a) | |
that checks if the array is column-magic (this means that every column has the same column sum). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write a method | |
public static boolean isSquare(int[][] a) | |
that checks if the array is square (i.e. every row has the same length as a itself). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write a method | |
public static boolean isMagic(int[][] a) | |
that checks if the array is a magic square. This means that it must be square, and that all row sums, all column sums, and the two diagonal-sums must all be equal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write a method | |
public static boolean isLatin(int[][] a) | |
that checks to see if the array is a Latin square. This means that it must be square (suppose it is n x n), and that each row and each column must contain the values 1, 2, ..., n with no repeats. | |
Some helper methods you may need for this example and the next are suggested in the tester code. Uncomment and run these tests if you implement these helper methods. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write a method | |
public static boolean isSequence(int[][] a) | |
that checks to see if the array is square (suppose it is n x n), and contains each of the digits from 1 to n*n, eg. 1, 2, ..., 16 for a 4 x 4 array. |
-----------------------------------------------------------]
Write a method
public static boolean isSequence(int[][] a)
that checks to see if the array is square........
please can you help me to answer the examp?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hola