Computer Science, asked by rsarawagi6410, 5 months ago

In asymptotic analysis, why do we always profer our
algorithms to be linear rather than quadratic, even
though to some-inputs, the quadratic algorithm
perfoms better than the linear one​

Answers

Answered by barnadutta2015
0

Answer: We may easily draw conclusions about an algorithm's best case, average case, and worst case scenarios using asymptotic analysis. While performing asymptotic analysis, the method is assumed to run in a fixed duration of time even in the absence of any input. All other variables are thought of as constants besides the "input."

Explanation:

  1. The development of a function f(n) as n increases is referred to as its asymptotic behaviour. Examples of such functions include f(n)=c*n, f(n)=c*n², etc. Since we are often concerned in calculating how sluggish the programme will be on large inputs, we typically neglect tiny values of n.
  2. A decent rule of thumb is that the algorithm is better the slower the asymptotic growth rate (although this is often not the whole story).
  3. According to this standard, a linear method, such as f(n)=d*n+k, is asymptotically superior to a quadratic one, such as f(n)=c*n²+q. This is thus because there is always some n at which the magnitude of c*n²+q exceeds d*n+k for every given (positive) c, k, d, and q.

Problems while using it are as follows:

In reality, there are additional factors to take into account besides asymptotic analysis while selecting an algorithm. An method with worse asymptotic behaviour may occasionally be preferred. Let algorithm A be asymptotically superior to algorithm B for the purposes of this debate. Typical problems with algorithms with superior asymptotic behaviour include the following:

  • Application difficulty
  • Better complexity algorithms are frequently (much) more complex. The constants and coding time may go up as a result.
  • little input size
  • Small input sizes are disregarded in asymptotic analysis. Constant factors or low order terms may dominate running time for tiny input sizes, outperforming A.
  • Comparing worst case and average performance
  • B might be a better option than A if A has better worst-case performance than B but B has better average performance given the expected input. In contrast, A must still be employed if B's worst-case performance is unacceptable (for instance, due to life-threatening or mission-critical circumstances).

To know more, click here:

https://brainly.in/question/17469691

https://brainly.in/question/359213

#SPJ5

Similar questions