I was going through some data structures and I noticed this as a time complexity: O(log(log(n))))-competitive.
I read that constant-competitive was the ratio of the expected time/optimal time. But what does it mean to have a set-competitive?
Logarithmic time complexity log(n): Represented in Big O notation as O(log n), when an algorithm has O(log n) running time, it means that as the input size grows, the number of operations grows very slowly.
O(logn) means that the algorithm's maximum running time is proportional to the logarithm of the input size. O(n) means that the algorithm's maximum running time is proportional to the input size. basically, O(something) is an upper bound on the algorithm's number of instructions (atomic ones).
Logarithmic Time Complexity O(Log n): The time Complexity of a loop is considered as O(Logn) if the loop variables are divided/multiplied by a constant amount. And also for recursive calls in the recursive function, the Time Complexity is considered as O(Logn).
Clearly log(n) is smaller than n hence algorithm of complexity O(log(n)) is better. Since it will be much faster.
Online algorithm is one which does not know its inputs in advance, and must "react" (in a sense) to unpredictable inputs. In contrast, offline algorithms are those which know all its inputs in advance.
Competitive analysis compares the performance of an optimal online algorithm to an optimal offline algorithm. Thus, k-competitive means that there is an offline algorithm which performs at most k-times worse than an online algorithm. So, O(lglgn) competitive means that the optimal offline algorithm performs at most lglgn (times a constant) times worse than the optimal online algorithm.
The term "k-competitive" can be thought of in the same manner as the term "k-approximation". A k-approximation means that the approximation algorithm performs at most k times worse than the optimal algorithm.
This can shed some light on your question.
From the above link:
Let A be any BST algorithm, define A(S) as the cost of performing sequence S and OPT(S, To) as the minimum cost to perform the sequence S. An algorithm A is T-competitive if for all possible sequences S, A(S) <= T * OPT(S, To) + O(m, n).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With