DATA STRUCTURES AND ALGORITHMS SESSION 3 PPT.pptx

AustindelaCruz1 0 views 26 slides Oct 10, 2025
Slide 1
Slide 1 of 26
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26

About This Presentation

Arrays – 1D & 2D, Sparse Matrix, Transposed Matrix, Magic Square


Slide Content

Arrays – 1D & 2D, Sparse Matrix, Transposed Matrix, Magic Square

Where do we use grids or tables in real life?

What happens when most of the table is empty?

Brief overview of array use in programming and how they represent tabular data efficiently.

1. What is a one-dimensional array? A. A list of rows and columns B. A single list of elements C. A list of dictionaries D. A tree structure

2. Which of the following is a valid way to access the second element in a list? A. list(2) B. list[2] C. list[1] D. list.2

3. What is a sparse matrix? A. A matrix with only string values B. A matrix with many zero values C. A matrix with no rows D. A matrix that is sorted

4. What does transposing a matrix mean? A. Reversing elements B. Removing all zero values C. Switching rows with columns D. Adding all rows together

5. A magic square has... A. Same numbers in each row B. Equal sum of all rows, columns, and diagonals C. All elements being prime D. A random arrangement of values

One-Dimensional Arrays  Define 1D array in Python.  Create, access, update, and iterate using loops.

Two-Dimensional Arrays  Introduction to 2D arrays using nested lists.  Access rows/columns, update elements.

Sparse Matrix  Define sparse matrix.  Introduce dictionary representation of non-zero elements.

Transposed Matrix  Explain how rows become columns.

Magic Squares  Define magic square (sums of all rows, columns, diagonals equal).  Simple check for 3x3 magic square.
Tags