A' is asymptotically faster than A

  • MHB
  • Thread starter evinda
  • Start date
In summary: You might mention it at the beginning of the article, or in the introduction. (Nerd)At which point could I mention it?...You might mention it at the beginning of the article, or in the introduction.
  • #1
evinda
Gold Member
MHB
3,836
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
  • #2
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$.
 
  • #3
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)
 
  • #4
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:
 
  • #5
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)
 
  • #6
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:
  • #7
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)
 
  • #8
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)
 
  • #9
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$. :eek:
 
  • #14
I like Serena said:
Oh, I meant $\alpha \le 16$. :eek:

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)
 

Related to A' is asymptotically faster than A

1. What does it mean for A' to be asymptotically faster than A?

It means that as the input size increases, the time or space complexity of A' will eventually surpass that of A. In other words, A' will be more efficient for larger input sizes.

2. How is the asymptotic speed of an algorithm calculated?

The asymptotic speed of an algorithm is determined by its Big O notation, which represents the worst-case time or space complexity of the algorithm as the input size approaches infinity.

3. Can an algorithm with a lower asymptotic speed be faster than one with a higher asymptotic speed?

Yes, an algorithm with a lower asymptotic speed may still be faster for smaller input sizes, as Big O notation only represents the growth rate of the algorithm as the input size increases.

4. Why is it important to consider asymptotic speed when analyzing algorithms?

Asymptotic speed allows us to compare and contrast the efficiency of different algorithms, particularly for large input sizes. It also helps us identify which algorithms will perform better in the long run and make informed decisions when selecting algorithms for specific tasks.

5. Are there any drawbacks to focusing on asymptotic speed?

Yes, asymptotic speed does not take into account the constant factors or lower order terms in the time or space complexity of an algorithm. This means that an algorithm with a better asymptotic speed may still have a larger constant factor or lower order terms, making it less efficient for smaller input sizes.

Similar threads

  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
6
Views
2K
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
292
  • Math Proof Training and Practice
Replies
25
Views
2K
  • Calculus and Beyond Homework Help
Replies
16
Views
620
  • Calculus and Beyond Homework Help
Replies
1
Views
578
  • Math Proof Training and Practice
2
Replies
69
Views
4K
Back
Top