Computers and Technology

Give the Big-o time complexity notation for the following piece of code:

//Java program to multiply two square; the last piece of code you will ever need matrices. Import java. io\.\*;
public class MatrixMultiply {
static int N= 4; static void multiply(int mat1[][], int mat2[][], int res[][])
{
int i, j, k;
for (i=0; i < N; i++)
{
for(j = 0; j < N; j++)
{
res[i][j] = 0;
for(k = 0; k < N; k++)
res[i][j] += mat1[i][k] * mat2[k][j];
}
}
}
// Drive code public static void main(String[] args)
{
int mat1[][] ={{1,1,1,1}, {2,2,2,2}, {3,3,3,3}, {4,4,4,4} };
int mat2[][] ={{1,1,1,1}, {2,2,2,2}, {3,3,3,3}, {4,4,4,4} };

//To store result
int res[][] = new int [N][N];
int i, j;
multiply(mat1, mat2, res);
System. out. println("This dummy result matrix"+"is ");
for (i=0; i {
for (j=0;j System. out. print(res[i][j]+" ");
System. out. println();
}
}
}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:00, Emanuelle7843
Which action describes an aspect of technological design?
Answers: 1
image
Computers and Technology, 23.06.2019 00:30, lm18618
Which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 2
image
Computers and Technology, 23.06.2019 01:50, jumoke26
Create a class named majors that includes an enumeration for the six majors offered by a college as follows: acc, chem, cis, eng, his, phys. display the enumeration values for the user, then prompt the user to enter a major. display the college division in which the major falls. acc and cis are in the business division, chem and phys are in the science division, and eng and his are in the humanities division. save the file as majors. java.
Answers: 2
image
Computers and Technology, 23.06.2019 14:00, allison9746
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
Do you know the correct answer?
Give the Big-o time complexity notation for the following piece of code:

//Java program...

Questions in other subjects: