Matricies Flashcards

(48 cards)

1
Q

What is a matrix?

A

A 2D array of numbers arranged in rows and columns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a row in a matrix?

A

A horizontal group of elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a column in a matrix?

A

A vertical group of elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the size or dimension of a matrix?

A

The number of rows and columns, represented as m x n.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a square matrix?

A

A matrix with the same number of rows and columns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a diagonal matrix?

A

A square matrix where all off-diagonal elements are zero.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an identity matrix?

A

A diagonal matrix with 1s on the diagonal and 0s elsewhere.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a zero matrix?

A

A matrix where all elements are 0.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a symmetric matrix?

A

A matrix equal to its transpose.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a transpose of a matrix?

A

A matrix obtained by swapping rows with columns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a sparse matrix?

A

A matrix where most elements are zero.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a dense matrix?

A

A matrix with few or no zero elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the time complexity to access an element in a matrix?

A

O(1) for direct access using indices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How is a matrix represented in code?

A

Typically as a list of lists or 2D array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is matrix addition?

A

Adding corresponding elements of two matrices of the same size.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is matrix subtraction?

A

Subtracting corresponding elements of two matrices of the same size.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is scalar multiplication in a matrix?

A

Multiplying every element by a constant.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is matrix multiplication?

A

A row-by-column operation producing a new matrix.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is the condition for matrix multiplication?

A

The number of columns in the first matrix must equal the number of rows in the second.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is the time complexity of matrix multiplication?

A

O(n^3) for naïve method; faster algorithms like Strassen’s exist.

21
Q

What is a triangular matrix?

A

A matrix where all elements below or above the main diagonal are zero.

22
Q

What is a lower triangular matrix?

A

A matrix where all elements above the diagonal are zero.

23
Q

What is an upper triangular matrix?

A

A matrix where all elements below the diagonal are zero.

24
Q

What is a row-major order?

A

Matrix elements are stored row by row in memory.

25
What is a column-major order?
Matrix elements are stored column by column in memory.
26
What is the determinant of a matrix?
A scalar value that can be computed from a square matrix.
27
What is the inverse of a matrix?
A matrix that, when multiplied with the original, gives the identity matrix.
28
What is the rank of a matrix?
The maximum number of linearly independent rows or columns.
29
What is a 2D array?
A data structure used to represent a matrix.
30
What is a common use of matrices in programming?
Representing grids, images, graphs, and transformations.
31
How do you iterate through a matrix?
Use nested loops over rows and columns.
32
What is the space complexity of an m x n matrix?
O(m * n)
33
What is a matrix rotation?
Rotating elements of a matrix 90, 180, or 270 degrees.
34
How do you rotate a matrix 90 degrees clockwise?
Transpose and then reverse each row.
35
What is a matrix diagonal traversal?
Accessing elements in a diagonal pattern from top-left to bottom-right.
36
How do you flatten a matrix?
Convert it into a 1D array by row-wise or column-wise traversal.
37
What is a matrix used for in graph representation?
Adjacency matrices represent connections between nodes.
38
What is the diagonal of a matrix?
Elements where the row index equals the column index.
39
What is matrix exponentiation?
Raising a matrix to a power, often used in dynamic programming.
40
What is a submatrix?
A smaller matrix formed by selecting specific rows and columns.
41
What is the trace of a matrix?
The sum of elements on the main diagonal.
42
What is matrix slicing?
Extracting specific rows or columns from a matrix.
43
Can matrices be sparse and symmetric?
Yes, a matrix can be both sparse and symmetric.
44
What is the difference between a matrix and a dataframe?
A matrix is a pure numerical 2D structure; a dataframe can have labeled rows/columns and mixed data types.
45
What is a block matrix?
A matrix partitioned into smaller submatrices.
46
What is an element-wise operation on a matrix?
Operations applied independently to each element.
47
What is the best data structure for storing sparse matrices?
Dictionary of keys (DOK) or compressed sparse row (CSR).
48
What is a Toeplitz matrix?
A matrix where each descending diagonal from left to right is constant.