Algorithm Analysis

Practice Questions

Computer Science › Algorithm Analysis

Page 1 of 4
10 of 32
1

Consider the following code:

O_n_

What is the expected runtime of the code (in Big-O notation?)

2

Consider the following code:

O_n_

What is the expected runtime of the code (in Big-O notation?)

3

Consider the following code:

O_2n_

What is the run time of the code (in Big-O notation?)

4

Consider the following code:

O_2n_

What is the run time of the code (in Big-O notation?)

5

Consider the following code:

O_n3_

What is the run time of the code (in Big-O notation)?

6

Consider the following code:

O_n3_

What is the run time of the code (in Big-O notation)?

7

for( int i = 0; i < n; ++i){

for( int j = 1; j < n; j *= 2){

someFunction();

}

}

For the code above, what is the run time in Big O notation?

8

for( int i = 0; i < n; ++i){

for( int j = 1; j < n; j *= 2){

someFunction();

}

}

For the code above, what is the run time in Big O notation?

9

Consider the following code:

O_log_n__

What is the run-time of the code (in Big-O notation?)

10

Consider the following code:

O_log_n__

What is the run-time of the code (in Big-O notation?)

Page 1 of 4
Return to subject