Big O class for (1/2) ^ n

In which class of Big O does the function (1/2) ^ n fall into?

On a purely mathematical basis, it seems that we would have to put it in O (1), because 1/2 ^ n approaches 0 for any sufficiently large n.

However, when it comes to asymptotic analysis and Big O, we tend to wave our arms a lot and also refer to formulas. 1/2 is technically constant, so it would seem to fall into O (c ^ n).

I lean toward O (c ^ n) because "half the operation" doesn't make sense when it comes to algorithms. Which algorithm takes half time as input increases? In the best case, I see the mathematical formula (1/2) ^ n, related to half of some constant time - say, a minute. So (30 seconds) ^ n becomes a huge number, and the function clearly belongs to O (c ^ n).

Help a little?

+4
source share
2 answers

The function 0.5 n is equal to O (1), as well as O (c) for any c> 0 (this is not O (0), since 0.5 n > 0 for any n).

It is also o (1) (note a little o ).

& Theta; (c) c. = 0, , 0,5 n > c n. s > 0 lim n β†’ & INFIN; 0,5 n .


, , & ​​Theta; (0.5 n), .

+2

O (1/2 ^ N), N , . "".

0

Source: https://habr.com/ru/post/1656533/


All Articles