#### Question

# What is the time complexity of adding three matrices of size NXN cell-by-cell?

What is the time complexity of adding three matrices of size NXN cell-by-cell?

#### Answers

The number of elements to be added is calculated in this way;

Total Number of Elements to be added = No. of pairs of matrix * ( no. of elements in each matrix)

for 3 matrix; it would come to ; total number of operations required =

(n*n) * 2 ( as there are 2 add operations , m1 + m2 + m3) ~= O(2*(n^2))

For large number of n; it would be O(N^2)

#1

O(n^2), addition count will be 2n^2.

#2