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:

  1. A.

    O(1)

  2. B.

    O(N)

  3. C.

    O(2N)

  4. D.

    O(N)2

Attempted by 2671 students.

Sign up free to check your answer

Sign up free

Explore the full course: Rssb Senior Computer Instructor

Loading lesson…