What kind of crazy algorithm is that?

Agnishom developed a complicated algorithm for purposes unknown.

He then wanted to analyse it's time complexity. After a lot of complicated math, he came up with the following recurrence relation:

T ( n ) = Θ ( n lg ( n ) ) + 1 n k = 2 n + 1 k ! T ( n k ! + π ( n ) lg k ( n ) ) T(n) = \Theta(n \text{lg}(n)) + \frac{1}{n} \sum_{k=2}^{n+1} k! T\left (\frac{n}{\sqrt{k!}} + \frac{\pi(n)}{\text{lg}^k(n)} \right)

Unfortunately, he doesn't have time to solve this recurrence.

That's where you come in : Solve the above recurrence relation!

To which of the following sets does T ( n ) T(n) belong to?

Notations:

  • lg ( n ) \text{lg}(n) denotes log 2 ( n ) \log_2(n) .
  • lg k ( n ) \text{lg}^k(n) denotes ( log 2 ( n ) ) k (\log_2(n))^k .
  • π ( n ) \pi(n) denotes the prime counting function .
  • k ! k! denotes the factorial function.
Θ ( n n ) \Theta(n^n) Θ ( n 2 ) \Theta(n^2) Θ ( n lg r ( n ) ) \Theta(n \text{lg}^r (n)) for a suitable r > 1 r>1 Θ ( n ) \Theta(n) Θ ( n lg ( n ) ) \Theta(n \text{lg} (n)) Θ ( n x lg y ( n ) ) \Theta(n^x \text{lg}^y (n)) for some suitable x > 1 , y > 1 x>1, y>1 Θ ( a n ) \Theta(a^n) for a suitable a > 1 a>1

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

We shall use the Akra-Bazzi Theorem as a heuristic tool.

Following the notations of the link, note that p = 2 p=2 .

So, T ( x ) Θ ( x 2 ( 1 + 1 x lg ( t ) t 2 d t ) ) T ( n ) Θ ( n 2 ) T(x) \in \Theta \left( x^2 \left( 1+ \int_1^x \frac{\text{lg}(t)}{t^2} \, dt \right) \right)\\\implies T(n) \in \Theta(n^2)

This can now be verified via the substitution method.

OMG, how did you know about that theorem?

Agnishom Chattopadhyay - 4 years, 10 months ago

Log in to reply

CLRS. The whole statement was given at the end of the chapter. I later looked it up in Wikipedia.

Quite a neat theorem. Allows you to ignore floors and ceilings.

A Former Brilliant Member - 4 years, 10 months ago

Log in to reply

Looks like you are going to rock the Algorithm Design and Analysis class

Agnishom Chattopadhyay - 4 years, 10 months ago

Thanks for letting us know about the Akra-Bazzi theorem.

From my understanding, the summation in this theorem is over a constant number of elements.

And a i a_{i} should be constant.

Abdelhamid Saadi - 4 years, 5 months ago

Log in to reply

Ah! Yes. The number of summands should've been constant.

But I just verified that the final result still holds.

I've edited my solution accordingly.

A Former Brilliant Member - 4 years, 5 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...