Help me pls clear explanation require? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Help me pls clear explanation require?

A square matrix is said to be symmetric if a(i, j) = a(j, i) for all i not equal to j. Such a symmetric square matrix may be stored in an array of half the size of the matrix in terms of number of elements. Derive the formula for index of one-dimensional array in terms of indices of symmetric square matrix for above storage scheme.

23rd Dec 2019, 3:54 AM
Piyush Srivastava
Piyush Srivastava - avatar
1 Answer
+ 7
1 3 2 9 3 1 4 8 2 4 5 7 9 8 7 6 Above is 4*4 square matrix.. why square bcz it has same number of rows and columns. Additionally , this is symmetrical as beelow condition is matched.. (0,1) means 3 is equal to (1,0) means 3 (0,2) means 2 is equal to (2,0) means 2 And so on... Now , you have to identify the unique elements of the matrix which would be half of total elements (16) in this case. Why half becuase matrix has (1,0) elements will be same as (0,1) element and so on. So, required output in this case of sample case is 8 indices for one dimensional array which stores unique 8 elements from matrix. -Hih Ketan
23rd Dec 2019, 4:09 AM
Ketan Lalcheta
Ketan Lalcheta - avatar