How would you prove that constant is a subset of logarithmic?

AI Thread Summary
Constant time complexity O(1) can be proven as a subset of logarithmic time complexity O(log n) by leveraging the definition of Big-Oh. For any function f in O(1), there exist constants x_0 and M such that f(x) is bounded above by M for all x greater than x_0. By choosing x_1 as the maximum of x_0 and n, it can be shown that f(x) remains less than or equal to M, which is also less than or equal to M log n for sufficiently large n. This demonstrates that O(1) is indeed a subset of O(log n), supporting the broader classification of time complexities. The discussion emphasizes the importance of understanding these relationships within the context of algorithm analysis.
aaa59
Messages
8
Reaction score
0
O(1) is constant
O(log n to the base 2) is logarithmic
O(n) linear

how would you prove that constant is a subset of logartihmic?
 
Mathematics news on Phys.org
O(1) = O(log_2 1) = O(0)
 
I should have been clearer.

given "Big-Oh" sets
O(1): constant
O(log2(n)): logarithmic
O(n): linear
O(nlog2(n)): n log n
O(n^2): quadratic
O(n^3): cubic
O(n^m), m>1: polynomial of order m
O(c^n), c>1: exponential
O(n!): factorial

Prove
Constant is a subset of logarithmic
logarithmic is a subset of linear
n log n is a subset of polynomial
exponential is a subset of factorial

Thank you
 
aaa59 said:
I should have been clearer.

given "Big-Oh" sets
O(1): constant
O(log2(n)): logarithmic
O(n): linear
O(nlog2(n)): n log n
O(n^2): quadratic
O(n^3): cubic
O(n^m), m>1: polynomial of order m
O(c^n), c>1: exponential
O(n!): factorial

Prove
Constant is a subset of logarithmic
logarithmic is a subset of linear
n log n is a subset of polynomial
exponential is a subset of factorial

Thank you
Most follow fairly easily from the definition of Big-Oh. For instance let f be an arbitrary function in O(1). We now wish to show that f is in O(\log_n(n)). Because of the definition of O(1) there exist some x_0 and M such that f(x) \leq M for all x > x_0. Now let x_1 = \max(x_0,n) then f(x) \leq M \leq M\log_n(x) for all x > x_1 so f(x) = O(\log_n(n)). Here we took advantage of the fact that the logarithm is increasing and \log_n(x) \geq 1 when x \geq n.

If you have problems with any specific steps you should post the specific problem you're having.
 
Seemingly by some mathematical coincidence, a hexagon of sides 2,2,7,7, 11, and 11 can be inscribed in a circle of radius 7. The other day I saw a math problem on line, which they said came from a Polish Olympiad, where you compute the length x of the 3rd side which is the same as the radius, so that the sides of length 2,x, and 11 are inscribed on the arc of a semi-circle. The law of cosines applied twice gives the answer for x of exactly 7, but the arithmetic is so complex that the...

Similar threads

Replies
2
Views
1K
Replies
2
Views
14K
Replies
1
Views
691
Replies
10
Views
2K
Replies
20
Views
4K
Back
Top