Classical

Data Structures - Algorithms

16:  

Consider the following two functions.
f(n) = n3, if 0  n < 10,000
        n2, otherwise
g (n) = n, if 0 n < 100
            n2+5n, otherwise
Which of the following is/are true?

A.

 f(n) is O(n3)

B.

 g(n) is O(n2)

C.

O(f(n)) is same as O(g(n))

D.

Both(b) and (c)

 
 

Option: D

Explanation :

≤n < 10,000
n2, otherwise
g (n) = n, if 0n < 100
n2+5n, otherwise
Which of the following is/are true?

'>
17:  

The correct matching for the following pairs is
(A) All pairs shortest path                    (1) Greedy
(B) Quick sort                                      (2) Depth-first search
(C) Minimum weight                             (3) Dynamic programming
 spanning tree
(D) Connected Components                 (4) Divide and conquer

A.

A-2 , B-4 , C-1, D-3

B.

A-3 , B-4 , C-l , D-2

C.

 A-3 , B-4 , C-2 , D-1

D.

A-4 , B-1 , C-2 , D-3

 
 

Option: B

Explanation :




Suggest an improvement