Let $m$, $n$ be integers such that $0 \leq m,n < N$. Define:
Algorithm A: Computes $m + n$ in time $O(A(N))$
Algorithm B: Computes $m \cdot n$ in time $O(B(N))$
Algorithm C: Computes $m\bmod n$ in time O(C(N))
Using any combination of algorithms A, B and C describe an algorithm for $N \times N$ matrix addition and matrix multiplication with entries in $\mathbb{Z}/N\mathbb{Z}$. Also indicate the algorithm's run time big-O notation.
Attempt at solution:
For $N \times N$ addition in $\mathbb{Z}/N\mathbb{Z}$: Let A, and B be $N \times N$ matrices in $\mathbb{Z}/N\mathbb{Z}$ with entries $a_{ij}$ and $b_{ij}$ such that i,j$\in\{0,1,\ldots,N\}$ where $i$ represents the row and $j$ represents the column in the matrix. Also, let A + B = C
Step 1. Run Algorithm A to get $a_{ij} + b_{ij}$ = $c_{ij}$ in time $O(A(N))$
Step 2. Run Algorithm C to get $c_{ij} \bmod N$ in time $O(C(N))$$
Repeat Steps 1 and 2 $ \forall$ $i,j\in\{0,1,\ldots,N\}$.
This means that we have to repeat the steps 1,2 $N^2$ times. So the total run time is estimated by $N^2[ O(A(N)) + O(C(N)) ] = O(N^2 A(N)) + O(N^2 C(N)) = O(|N^2 A(N)| + |(N^2 C(N)|)$.
For multiplication algorithm I just replaced step 1 by Algorithm B and got the total run time to be $O(|N^2 B(N)| + |(N^2 C(N)|) $ just like above.
Please tell me if I am approaching this problem correctly, especially with the big-O notation.
Thanks.