Question discussion

What is the time complexity of the following code snippet? for (int i = 1; i

552Medium DSSSB TGT Computer Science 0 replies 1 views
0
What is the time complexity of the following code snippet? for (int i = 1; i <= n; i *= 2) { for (int j = 1; j <= n; j++) { // O(1) operation } }
  • AO(n)
  • BO(n log n)
  • CO(log n)
  • DO(n²)
Correct answer: B

Discussion 0

Nobody has replied yet. Start the discussion!