What is the time complexity of adding three matrices of size NXN cell-by-cell ?
D. None of these
Answer : B. O(N2)
- Time complexity will be O(n2), because if we add all the elements one by one to other matrics we have to traverse the whole matrix at least 1 time and traversion takes O(n2) times.
- With this traversion we add 3 elements of location [ i, j ] and storing the result on other matrix at [ i, j ] location.