Given four algorithms A, B, C, D with time complexities as follows:
A-O(n)
B-O(log log n)
C-O(log n)
D-O(1)
where n > 1
Select the option, which gives the algorithms in increasing order of their time complexities.
-
C B A D
-
B C D A
-
A D B C
-
A D C B
-
None of these
B
Correct answer
Explanation
yes of the given time complexities the one with time O(log log n) is smallest because logarithm of a number is significantly small, here we are applying another logarithm which makes it much smaller, the next smaller will be O(log n) followed by O(n) and O(1) which makes it B C D A