3 ms·
depends how big n gets in the context of that particular function. a O(2^n) can be faster real world that O(1) if the overhead of the O(1) is bigger than the O(
by cultofmetatron 10y ago
depends how big n gets in the context of that particular function. a O(2^n) can be faster real world that O(1) if the overhead of the O(1) is bigger than the O(2^n) version. Its important to remmeber that big O is a measure of worst case as n grows. If N is bounded by the realities of the business case, it might not be so bad.
- flamedoge 10y agobig O assumes n is asymptotic and unbounded. But anyway, constant time might be more deterministic which is a good quality.