A' should be asymptotically faster than A

  • MHB
  • Thread starter evinda
  • Start date
In summary, we are given two algorithms, $A$ and $A'$, with execution times described by $T(n)=7T\left( \frac{n}{2}\right)+n^2$ and $T'(n)=aT'\left( \frac{n}{4} \right)+n^2$, respectively. We are asked to find the greatest integer value of $a$ for which $A'$ is asymptotically faster than $A$. Using the recurrence relations and Big O notation, we find that $a$ must be less than 16 for this to be true. However, if $f(n)=\Theta(n^{\log_b a})$, then $A'$ cannot be asymptotically
  • #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 execution time of an algorithm $A$.

A "competitor" algorithm, let $A'$, has execution time $T'(n)=aT'\left( \frac{n}{4} \right)+n^2$.

Which is the greatest integer value of $a$, for which $A'$ is asymptotically faster than $A$?

$$T(n)=7T\left( \frac{n}{2}\right)+n^2$$
$$a=7 \geq 1, b=2>1, f(n)=n^2$$

$$n^{\log_b a}=n^{\log_27}<n^{\log_2 4}=n^2$$

We see that $f(n)=O(n^{\log_b a-\epsilon})$, for example for $\epsilon=0.8$.

So, $T(n)=\Theta(n^{\log_b a})=\Theta(n^2)$

$$T'(n)=aT'\left( \frac{n}{4} \right)+n^2$$
$$b=4, f(n)=n^2$$
$$n^{\log_b a}=n^{\log_4 a}$$

  • $f(n)=O(n^{\log_b a+ \epsilon})$, then $T'(n)=\Theta(n^{\log_4 a})$

    We want to that $A'$ is asymptotically faster that $A$, so it must be $n^{\log_4 a}<n^2 \Rightarrow n^{\log_4 a}< n^{\log_4 4^2} \Rightarrow a<16$
    $$$$
  • $f(n)=\Theta(n^{\log_b a})$, then $T'(n)=\Theta(n^{\log_4 a} \log_2 n)$

    We want to that $A'$ is asymptotically faster that $A$, so it must be $n^{\log_4 a} \log_2 n<n^2$

    How can we find the $a$s, for which this inequality stands? :confused:
    $$$$
  • $f(n)=\Omega(n^{\log_b a+ \epsilon})$, then $T'(n)=\Theta(f(n))=\Theta(n^2)$

    So, in this case, we cannot find $a$s so that $A'$ is asymptotically faster than $A$.

Is that what I have tried right? (Thinking)
 
Technology news on Phys.org
  • #2
Or have I done something wrong? (Thinking)
 

FAQ: A' should be asymptotically faster than A

What does it mean for something to be asymptotically faster?

Asymptotically faster means that as the input size of a problem increases, the time or space complexity of the algorithm also increases but at a slower rate compared to another algorithm. This does not necessarily mean that the asymptotically faster algorithm will always be faster for smaller input sizes.

How is asymptotic speed measured?

Asymptotic speed is measured by analyzing the time or space complexity of an algorithm using big O notation. This notation describes the upper bound of the algorithm's growth as the input size increases.

What are the advantages of using an asymptotically faster algorithm?

An asymptotically faster algorithm can significantly reduce the time and space required to solve a problem as the input size increases. This can lead to more efficient and scalable solutions for complex problems.

Can all algorithms be compared using asymptotic speed?

No, asymptotic speed can only be used to compare algorithms that solve the same problem. It does not take into account other factors such as implementation details or hardware specifications, which can also affect the performance of an algorithm.

Is an asymptotically faster algorithm always the best choice?

Not necessarily. While an asymptotically faster algorithm may have better performance for larger input sizes, it may also have higher constant factors or hidden costs that make it less efficient for smaller input sizes. It is important to consider the specific requirements and constraints of a problem when choosing an algorithm.

Similar threads

Replies
15
Views
7K
Replies
17
Views
1K
Replies
2
Views
970
Replies
15
Views
2K
Replies
7
Views
4K
Replies
1
Views
1K
Replies
1
Views
1K
Back
Top