Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

University Algiers 1 - Benyoucef Benkhedda

Faculty of Sciences
Department of Mathematics
1st Year, Academic Year 2023/2024
Sections: A & B
Module: Algorithms and Data Structures.

TD Series # 3
Array – Matrix structures

(Array part)

Exercise #1:
Write the program that calculates the sum and product of the elements of an array V.

Exercise #2:
Write an algorithm to determine the minimum, maximum and average of the elements of an
array of N integers (N<=30).

Exercise #3:
Write an algorithm that displays the percentages of strictly positive and negative numbers in an
array of 100 real numbers.

Exercise #4:
Write an algorithm to calculate the scalar product of two integer arrays V1 and V2 of dimension
D=20.

Exercise #5:
Let be an array T. Write the algorithm to construct the array T1 containing the even elements of
T, and the array T2 containing the odd elements of T. (Use the MOD function).

Exercise #6:
Let be two sorted integer arrays VI and V2. Write an algorithm that merges these two arrays into
another sorted array V3 without repeating identical values.
Example:

V I -1 0 3 5 8 10

V2 -3 -1 2 3 6 8 12 14

V3 -3 -1 0 2 3 5 6 8 10 12 14

1/2
(Matrix part)

Exercise #7:
Write an algorithm that:
1. Calculates the product of two matrices A and B.
2. Calculates the sum of the elements of the 1st and 2nd diagonals of a square matrix A.
3. Calculates the sum of the coefficients of each row of a matrix A and puts the results in an
array.

Exercise #8:
Write an algorithm to calculate the number of letters in the main diagonal of a square matrix
of size N*N containing characters.

Exercise #9:
Let be a matrix A. Write an algorithm to:
1. Determine the sum of the elements in each column,
2. Display the Pmin and Pmax representing the positions of the max and min sums
3. Permute the elements of the Pmin and Pmax columns of the matrix.

2/2

You might also like