Fundamentals of Algorithms

Question #181

Read the question, compare the options, and review the correct answer below.

CS502 · Final-term only#181

Consider the following code:
For(j=1; j<n;j++)
For(k=1; k<15;k++)
For(l=5; l<n; l++)
{
Do_something_constant();
}
What is the order of execution for this code.

  1. A
    ? O(n)
  2. B
    ? O(n
    3
    )
  3. C
    ? O(n
    2
    log n)
  4. D
    ? O(n2
    )
Show correct answer

Correct answer: A. ? O(n)

Check community answers against your course notes.
← More practice questionsTake a timed test