[Self] data structures Chapter III, arrays, end of not hanging branches Guide, 5

Array

The concept follows

A linear array can be seen as a generalization of the table, the table is actually a linear, 一维数组also called vector
data composed of a set of data elements having the same type of composition, and is stored in a set of consecutive memory cells
, if one-dimensional array data element is one-dimensional array, it is called 二维数组and so on, can be obtained 三维数组, and多维数组

An array of basic operations

Array is usually only two basic operations

  1. Read: given a set index, the contents of which position the element returns
  2. Write: Given a set of index, modify the position of the element content

Storage structure array

Address of memory element array is one-dimensional continuous
two-dimensional array can be stored in two ways: one is 列序mainly stored sequence; the other is a 行序main sequence memory.
== C language, the arrays are used in line-sequential order based storage ==

Compressed storage matrix (focus)

In numerical analysis, often some higher order matrices, these matrices have many of the same high-order value zero element or elements, in order to save memory space, the same plurality of values ​​of the elements of such a matrix only allocate storage space, zero policy elements are not stored, this method is矩阵的压缩存储

Special Matrices

Special textbooks matrix involves two major 对称矩阵and三角矩阵

These two parts are conceptual problem, accounting for a very small part of the examination of a number of test sites, their own learning what you can, look at the focus of the following稀疏矩阵

sparse matrix

Suppose a matrix of m rows and n columns with a non-zero elements of t, when t << m * n, is called a sparse matrix
Data Structure Self

The figure which is only a few non-zero elements, it is a kind of sparse matrix

Triples notation

Sparse matrix notation the general triples, represented by three terms in the sparse matrix of non-zero elements of a ~ ij ~, i.e. (i, j, a ~ ij ~), where i represents a row number, j represents a column number , the value of non-zero elements of a ~ ij ~.

The above sparse matrix if the triple table is as follows
((0,1,5), (2,1, -1), (2,3,7), (3,1,6), (4, 4,9))

Well, the above is a very important test sites, the next few tests to get true problem and thought it

Self Exams

The first problem: Given a 7x6 sparse matrix, the test write triples represented sparse matrix shown in FIG.
Data Structure Self

answer:

((0,0,16),(0,5,-16),(1,2,3),(2,3,-8),(4,0,91),(6,2,15))

The second question: triplet sparse matrix A shown in FIG, write the sparse matrix representation A

Data Structure Self

answer:

((0,2,5),(1,0,-1),(2,5,2),(3,4,8),(4,3,5),(5,1,7))

Answer techniques

  1. Row, column number is 0 from the beginning, not the number of poor
  2. The front row number, column number after
  3. The outermost layer and a brace of it

Guess you like

Origin www.cnblogs.com/happymeng/p/shujujiegou_5.html