Data structure-4.5 strings, arrays and generalized tables
- Preface-Data Structure
-
- Array
-
- Symmetric matrix (special matrix compression storage)
- Band matrix! [Insert picture description here](https://img-blog.csdnimg.cn/20201107151812769.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNz80MT3FFczwcz_color,IFF_color,Imv0bl,16Ly9ibG9nLmNz80ZG4dubmV0size t_70#pic_center)
- sparse matrix
Preface-Data Structure
The data structure needs to be chewed repeatedly, and the answers to the problems encountered in the development can be obtained at any time.
Array
Symmetric matrix (special matrix compression storage)
- Symmetric matrix elements can only store the lower triangular part, requiring a total of n(n+1) 2 units of space (the storage method of triangular matrices is similar)
- Taking a one-dimensional array sa[] as the storage structure of the n-th order symmetric matrix A, there is the following correspondence between any element aij in A and its storage location sa[k]:
- The formula of a symmetric matrix: a53 = 5*(5+1)/2 + 3 = 18
Band matrix
sparse matrix
- Thinking about how to store it, how it is stored