subject

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();
}
}
}

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 06:00, kamilahmcneil3969
What are the most likely causes of conflict at the meeting? check all that apply.
Answers: 1
image
Computers and Technology, 22.06.2019 11:00, kingethan08
Ihave an iphone 8plus should i get another phone like samsung note 9 or s9 ? ?
Answers: 2
image
Computers and Technology, 22.06.2019 20:00, jayjay5246
What is the term for water wave that is created by an underwater earthquake
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, deflox74
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
You know the right answer?
Give the Big-o time complexity notation for the following piece of code:

//Java program...

Questions in other subjects:

Konu
Mathematics, 18.06.2021 01:00