MHB A' is asymptotically faster than A

  • Thread starter Thread starter evinda
  • Start date Start date
AI Thread Summary
The discussion centers on determining the largest integer value for the parameter \( a \) in the recurrence relation \( T'(n) = aT'\left(\frac{n}{4}\right) + n^2 \) such that algorithm \( A' \) is asymptotically faster than algorithm \( A \), described by \( T(n) = 7T\left(\frac{n}{2}\right) + n^2 \). It concludes that for \( A' \) to be asymptotically faster, \( a \) must be less than 49, specifically 48, since at \( a = 49 \), both algorithms exhibit the same asymptotic speed. The analysis also highlights that for \( a \leq 16 \), \( A' \) will be even faster, and thus, checking values below 16 is unnecessary for determining asymptotic speed. The final consensus is that the greatest value for \( a \) ensuring \( A' \) is asymptotically faster than \( A \) is indeed 48.
evinda
Gold Member
MHB
Messages
3,741
Reaction score
0
Hello! (Wave)

The recurrence relation $T(n)=7T\left( \frac{n}{2} \right)+ n^2$ describes the running time of an algorithm $A$.
A competing algorithm $A'$ has a running time of $T'(n)=aT'\left( \frac{n}{4}\right)+n^2$.
What is the largest integer value for $a$ such that $A'$ is asymptotically faster than $A$ ?

$$
T(n) = 7\left[ 7T\left(\frac{n}{4}\right) + \frac{1}{4}n^2\right] + n^2 = 49 T\left(\frac{n}{4}\right) + \frac{11}{4}n^2,
$$
$a = 49$, $b = 4$, and $f(n) = \frac{11}{4}n^2$

$n^{\log_b a}=n^{\log_4{49}}>n^2$

$f(n)=\Omega(n^{\log_b a+ \epsilon})$ for $\epsilon=0.8>0$.

So from the case 1 of the master theorem we conclude that $T(n) \in \Theta\left(n^{\log_4 49}\right)$.

If we assume that the initial values of the two recurrence relations are the same then we see that $T(n) \geq T'(n)$ if $a \leq 49$.$$
T'(n) = a T'\left(\frac{n}{4}\right) + n^2.
$$

$a = a$, $b = 4$, and $f(n) = n^2$

If $a > 16$ then $\log_4 a>2$.

Then from the case case 1 of the master theorem we have that
$$
T'(n) \in \Theta\left(n^{\log_4 a}\right).
$$$n^{\log_4 49} \in o\left(n^{\log_4 a}\right)$ if $a > 49$,

so we conclude that $T(n) \in o\Bigl(T'(n)\Bigr)$ if $a > 49$.

So can we say that the greatest value for $a$ so that $A'$ is asymptotically faster than $A$ is $49$ or do we have to say that for $a=49$ the two algorithms have the same speed and the largest value for $a$ so that $A'$ is asymptotically faster than $A$ is $48$? (Thinking)
 
Technology news on Phys.org
Could we also say the following? (Thinking)We have the recurrence relation $T(n)=7T\left( \frac{n}{2}\right)+n^2$ and the solution is $T(n)=\Theta(n^{\log_{4}{49}})$.
We also have the recurrence relation $T'(n)=\alpha T'\left( \frac{n}{4} \right)+n^2$.

$a=\alpha, b=4, f(n)=n^2$

$n^{\log_b a}=n^{\log_4 \alpha}$
For $\alpha>16$, $f(n)=O(n^{\log_b{\alpha}}- \epsilon), \epsilon>0$

So for $\alpha>16$: $T'(n)=\Theta(n^{\log_4{\alpha}})$

So that $A'$ is asymptotically faster than $A$, it has to hold $n^{\log_4{\alpha}}< n^{\log_4{49}} \Rightarrow \log_4{\alpha}<\log_4{49} \Rightarrow \alpha<49$So the greatest value for $\alpha$ so that $A'$ is asymptotically faster than $A$ is $48$.
 
Hi! (Smile)

evinda said:
So can we say that the greatest value for $a$ so that $A'$ is asymptotically faster than $A$ is $49$ or do we have to say that for $a=49$ the two algorithms have the same speed and the largest value for $a$ so that $A'$ is asymptotically faster than $A$ is $48$? (Thinking)

I'd say the latter.
And I wouldn't say "the same speed", but "the same asymptotical speed". (Nerd)
 
I like Serena said:
Hi! (Smile)
I'd say the latter.
And I wouldn't say "the same speed", but "the same asymptotical speed". (Nerd)

Saying the latter, I don't have to say anything about asymptotical speed, do I? (Thinking)
And something else... Do we also have to check the case when $\alpha \leq 16$? :confused:
 
evinda said:
Could we also say the following? (Thinking)

So the greatest value for $\alpha$ so that $A'$ is asymptotically faster than $A$ is $48$.

Seems fine to me. (Smile)
evinda said:
Saying the latter, I don't have to say anything about asymptotical speed, do I? (Thinking)
And something else... Do we also have to check the case when $\alpha \leq 16$? :confused:

You're supposed to say something about "faster asymptotical speed". There is no need to say something about "the same asymptotical speed".

The algorithm will only be even faster in the case $\alpha \leq 16$, so there is no need to check it explicitly.
You might mention that though. (Nerd)
 
I like Serena said:
Seems fine to me. (Smile)

(Smile)

I like Serena said:
You're supposed to say something about "faster asymptotical speed". There is no need to say something about "the same asymptotical speed".

The algorithm will only be even faster in the case $\alpha \leq 16$, so there is no need to check it explicitly.
You might mention that though. (Nerd)

If $\alpha=16$ the solution of the recurrence relation will be $T(n)=\Theta(n^2 \lg n)$ and if $\alpha<16$ the solution of the recurrence relation will be $T(n)=\Theta(n^2)$, right?

If I want to mention it, what could I say? (Thinking)
 
Last edited:
evinda said:
If $\alpha=16$ the solution of the recurrence relation will be $T(n)=\Theta(n^2 \lg n)$ and if $\alpha<16$ the solution of the recurrence relation will be $T(n)=\Theta(n^2)$, right?

I haven't checked it, but that looks about right. (Smile)

If I want to mention it, what could I say? (Thinking)

I'd mention what I just wrote: "The algorithm will only be even faster in the case α≤16, so there is no need to check it explicitly." (Nerd)
 
I like Serena said:
I'd mention what I just wrote: "The algorithm will only be even faster in the case α≤16, so there is no need to check it explicitly." (Nerd)
At which point could I mention it? (Thinking)
 
evinda said:
At which point could I mention it? (Thinking)

Just before you state the conclusion.
It shows you've considered all possible cases. (Wasntme)
 
  • #10
I like Serena said:
Just before you state the conclusion.
It shows you've considered all possible cases. (Wasntme)

Nice! (Happy)

After writing the recurrence relation, can I just write $\alpha \geq 1$ in order to apply the Master theorem or do I have to write that I assume that it is like that? (Thinking)
 
  • #11
evinda said:
Nice! (Happy)

After writing the recurrence relation, can I just write $\alpha \geq 1$ in order to apply the Master theorem or do I have to write that I assume that it is like that? (Thinking)

I would write "If we assume $\alpha \geq 1$, we can apply the Master Theorem", and then apply it.

At the end, before the conclusion, I would mention that with $\alpha < 16$ the algorithm will only be faster.
That covers all cases that were not verified explicitly, including the assumption that $\alpha \geq 1$. (Wasntme)
 
  • #12
I like Serena said:
I would write "If we assume $\alpha \geq 1$, we can apply the Master Theorem", and then apply it.
A ok... (Nod)

I like Serena said:
At the end, before the conclusion, I would mention that with $\alpha < 16$ the algorithm will only be faster.
That covers all cases that were not verified explicitly, including the assumption that $\alpha \geq 1$. (Wasntme)

Do I also have to say then something for the case $\alpha=16$? (Thinking)
 
  • #13
evinda said:
A ok... (Nod)

Do I also have to say then something for the case $\alpha=16$? (Thinking)

Oh, I meant $\alpha \le 16$. :o
 
  • #14
I like Serena said:
Oh, I meant $\alpha \le 16$. :o

For $16<\alpha<49$ we have that $T'(n)=\Theta(n^{\log_b {\alpha}})$ and $^2<n^{\log_4 a}<n^{\log_4{49}} \approx n^{2.8}$, right?
For $\alpha=16$ the solution of the recurrence relation is $T'(n)=\Theta(n^2 \lg n)$.
So couldn't it be that the latter isn't less than the former? Or am I wrong? :confused:
 
  • #15
evinda said:
For $16<\alpha<49$ we have that $T'(n)=\Theta(n^{\log_b {\alpha}})$ and $^2<n^{\log_4 a}<n^{\log_4{49}} \approx n^{2.8}$, right?
For $\alpha=16$ the solution of the recurrence relation is $T'(n)=\Theta(n^2 \lg n)$.
So couldn't it be that the latter isn't less than the former? Or am I wrong? :confused:

No. If an algorithm takes less steps to execute, it will always be faster.
And indeed, as you can see $n^2 \lg n$ is asymptotically less than $n^{2.8}$.
It's even stronger: the lower $\alpha$ is, the lower $T'(n)$ is, all other things being the same. (Wasntme)
 
  • #16
I like Serena said:
No. If an algorithm takes less steps to execute, it will always be faster.
And indeed, as you can see $n^2 \lg n$ is asymptotically less than $n^{2.8}$.
It's even stronger: the lower $\alpha$ is, the lower $T'(n)$ is, all other things being the same. (Wasntme)

I see... Thank you very much! (Party)
 

Similar threads

Replies
1
Views
1K
Replies
17
Views
1K
Replies
15
Views
2K
Replies
7
Views
5K
Replies
2
Views
1K
Replies
25
Views
4K
Replies
16
Views
2K
Back
Top