-
Determinant of matrix
The determinant of a matrix can be cal- culated by taking performing the following for every entry in the 0th row of a matrix.
(a) If the matrix has only 1 row and 1 column, then the determinant is just whatever that 1 entry is.
(b) Otherwise, for a number in the ith column (starting from zero) and 0th row, cross off (temporarily) the entire ith column and 0th row.
(c) The resulting matrix has 1 fewer row and 1 fewer column after crossing them off. Take the determinant of this matrix and multiply the result by the value in the ith column and 0th row.
(d) If i is odd, multiply the result by negative 1. (e) Sum up all such results.
USING RECURSION write a method to calculate the determinant of a matrix.
The header should look something like this:
public static int calculateDeterminant(int[][] m)
-
Hi osenna, welcome to the forum.
I'm sure you don't expect anyone here to do your homework for you! (for this or the other 3 posts) But to get started and provide some help we need to know what the problem is: not the assignment you were given, but the problem you have doing that assignment.
Do you understand the assignment? If not, what questions do you have about it?
Have you written code to attempt to do what the assignment asks? If you have and there are compiler messages that you can't understand, post the code and the entire compiler message(s).
Does your program compile sucessfully but do something weird at runtime? (throw an exception, or give a result that you know is incorrect). If so, post the code and say what the actual behaviour at runtime is, and what you were expecting to happen.
-----
I guess this observation and these questions apply to your other posts, although I haven't read them in any detail.
-
Let's close all of the homework dump threads and start over. Osenna, I invite you to repost any questions that you have, but please show your work and ask a specific question. Repeatedly posting homework or interview dumps can result in your being banned.