Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does O(log(log(n))))-competitive mean?

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?

like image 777
unj2 Avatar asked May 30 '09 10:05

unj2


People also ask

What does O log n mean exactly?

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.

What is the difference between O N and O log n?

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).

What is O logn time complexity?

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).

Is N or log n faster?

Clearly log(n) is smaller than n hence algorithm of complexity O(log(n)) is better. Since it will be much faster.


2 Answers

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.

like image 105
kanak Avatar answered Sep 17 '22 14:09

kanak


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).

like image 42
Nick Dandoulakis Avatar answered Sep 17 '22 14:09

Nick Dandoulakis