Image

Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Upper bound of the complexity of an algorithm on two variables

+2
−0

I've determined the complexity of an algorithm to be

sqrt(2*pi/e)
* (log(n)/log(1/1-p) /e) ^ (log(n)/log(1/p) + 1)
/ sqrt(log(n)/log(1/p))

Where the variables are:

n: the input size; it's an integer >=1.
p: a coefficient in the range (0, 1).

The plots show that the worst case of p is moving. It initially grows (for n<10^5 or so), with a maximum at p=0.95 or so, and then decreases slowly (but remaining above 0.5, or so it seems). For most of the curve, we can approximate it as p=0.9, and consider it fixed.

Thus, for the worst case, the only variable seems to be n.

Let's hide the constants (or almost constants) (every C is a different C):

C * (C*log(n)) ^ (C*log(n) + C) / sqrt(C*log(n))

Am I right considering this algorithm to be in O((log(n))^(log(n))) and thus sub-exponential (more precisely, quasi-polynomial)?

History

0 comment threads

1 answer

+2
−0

This is not entirely correct. An algorithm is $\Theta(f(n))$ if, asymptotically, it is within some constant factor of $f$. Thus we cannot simply add or take away constant factors from within an exponential.

We can, however, do so if we talk about the log of running time, which is $\Theta(\log(n) \log(\log(n)))$.

I think (but am not sure that) it's also not atypical, in such cases, to say that the algorithm is $\Theta(n^{C \log(\log(n))})$---not indicating by this a particular C but merely saying that the algorithm grows faster than $n^{C \log(\log(n))}$ for some low value of $C$ and slower than $n^{C \log(\log(n))}$ for some high value of $C$.

As alx commented we can say more tersely that the algorithm is quasipolynomial; indeed it is below $e^{\log(n)^2}$ and thus a "relatively fast" quasipolynomial algorithm.

History

2 comment threads

Moving the constants to the base of the log. (1 comment)
In what class is this? (4 comments)

Sign up to answer this question »