MHB A' should be asymptotically faster than A

  • Thread starter Thread starter evinda
  • Start date Start date
AI Thread Summary
The discussion revolves around comparing the execution times of two algorithms, A and A', defined by their respective recurrence relations. The algorithm A has a recurrence of T(n) = 7T(n/2) + n^2, leading to a time complexity of Θ(n^2). The competitor algorithm A' has a recurrence of T'(n) = aT'(n/4) + n^2, and for A' to be asymptotically faster than A, the condition a < 16 must hold. The analysis concludes that if a is greater than or equal to 16, A' cannot achieve a faster asymptotic performance than A. The discussion seeks clarification on the correctness of these findings.
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 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
Or have I done something wrong? (Thinking)
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
I am trying to run an .ipynb file and have installed Miniconda as well as created an environment as such -conda create -n <env_name> python=3.7 ipykernel jupyter I am assuming this is successful as I can activate this environment via the anaconda prompt and following command -conda activate <env_name> Then I downloaded and installed VS code and I am trying to edit an .ipynb file. I want to select a kernel, via VS Code but when I press the button on the upper right corner I am greeted...

Similar threads

Back
Top