2. Array: What is?
• Arrays a kind of data structure that can store a fixed-size sequential
collection of elements of the same type.
• In computing, row-major order and column-major order describe
methods for arranging multidimensional arrays in linear storage such
as memory
4. Basic Operations of An Array
• Following are the basic operations supported by an array.
• Traverse − print all the array elements one by one.
• Insertion − add an element at given index.
• Deletion − delete an element at given index.
• Search − search an element using given index or by value.
• Update − update an element at given index.
5. Sparse Matrix
• a sparse matrix is a matrix in which most of the elements are zero
• The number of zero-valued elements divided by the total number of
elements (e.g., m × n for an m × n matrix) is called the sparsity of the
matrix
6. Triplet Representation (Array Representation)
12/27/2023
• Considers non-zero values
• the 0th row stores the total number of rows, total number of columns
and the total number of non-zero values in the sparse matrix
7. Array Representation of Polynomial
• A polynomial is an expression that contains more than two terms.
• A term is made up of coefficient and exponent.
• An example of polynomial is
• P(x) = 4x3+6x2+7x+9
• Array representation assumes that the exponents of the given
expression are arranged from 0 to the highest value (degree)
• The coefficients of the respective exponent are placed at an
appropriate index in the array.
8. Array Representation of Polynomial(Contd.)
• The array representation for the above polynomial expression is given
below:
9. Array Representation of Polynomial(Contd.)
• Consider a polynomial with two variables: 2x2+5xy+y2.
10. Polynomial Addition using Array
• The steps to add the polynomials are listed below.
• First identify the highest degree polynomial. The degree of the
resultant polynomial is same as the polynomial with the highest
degree.
• Store the coefficient in the index specified by the exponents of the
polynomial.
• Add the coefficients stored in one array with the corresponding index
positions in the other array and store the result in the same index
position in the resultant array.
12. MCQ
• Who coined the term Sparse Matrix?
a) Harry Markowitz
b) James Sylvester
c) Chris Messina
d) Arthur Cayley
12/27/2023
13. MCQ: Answer
• Answer: a
Explanation: Harry Markowitz coined the term Sparse Matrix. James Sylvester
coined the term Matrix. Chris Messina coined the term Hashtag and Arthur
Cayley developed the algebraic aspects of a matrix.
12/27/2023
14. MCQ
• x2+2x+1 is a polynomial of-
1.One variable
2.Two variable
3.Three variable
4.Four variable
16. MCQ
• What is the relation between Sparsity and Density of a matrix?
a) Sparsity = 1 – Density
b) Sparsity = 1 + Density
c) Sparsity = Density*Total number of elements
d) Sparsity = Density/Total number of elements
12/27/2023