Given the following program fragment to add two integer arrays A and B, each…
NVS Computer Science / IT Teacher Recruitment · Computer Science · 2022
Given the following program fragment to add two integer arrays A and B, each of size N. The sum is stored in integer array C of the same size. for (i = 1; i <= N; i++) C[i] = A[i] + B[i]; The running time of this for loop is:
- A.
O(1)
- B.
O(N)
- C.
O(2N)
- D.
O(N)2
Attempted by 2671 students.
Sign up free to check your answer
Sign up freeLoading lesson…