Some Little Questions

Nov 16 2011 12:23 PM
 I'm in stuck about these questions if you help me i will owe you.


 

 

1- Write a program that finds a given sparse matrix is a skew-symmetric matrix or not. The program should print true or false.

Don't take any input from the user, assign the sparse array in the program code.

 

A skew-symmetric matrix is a square matrix A whose transpose is also its negative; that is, it satisfies the equation A = -AT.  If the entry in the i th row and j th column is aij, i.e. A = (aij) then the symmetric condition becomes aij = -aji. 

 

 

 

2- Write a program that shifts the elements of each row of a sparse matrix array by n positions.

 

   Example:

Input:  

int[,] s = new int[,] {{6,6,8},{0,0,15},{0,3,22},{0,5,-15},{1,1,11}, {1,2,3}, {2,3,-6}, {4,0,91}, {5,2,28}};

 

15  0  0  22  0  -15

 0 11  3   0  0    0

 0  0  0  -6  0    0

 0  0  0   0  0    0

91  0  0   0  0    0

 0  0 28   0  0    0

 

        Shift by 2 positions

  Output:

0  -15  15  0   0  22 

0   0    0  11  3   0 

0    0   0  0   0  -6 

0    0   0  0   0   0 

0    0  91  0   0   0 

0    0   0  0  28   0 


Answers (4)