Computer Science, asked by dipaleep8584, 16 days ago

A program is written in 3 stages where the first stage is of O(n log n) , the second stage is of O(n^2)
which is based on the result of the first stage, and the third stage is of O(n). What will be asymptotic complexity of the entire program?

Answers

Answered by mohanharkarrevanth6
0

Answer:

fjfjfjdjdjfkkfzgz

Explanation:

cjcjchcjcjcjfjdshgshzgjxsxhdhmdhdj bcdefghijklmnop1rstuv

Answered by abdulraziq1534
0

Concept Introduction:-

Algorithm comparisons are based on asymptotic complexity.

Given Information:-

We have been given that A program is written in 3 stages where the first stage is of O(n log n), the second stage is of O(n^2) which is based on the result of the first stage, and the third stage is of O(n).

To Find:-

We have to find that the asymptotic complexity of the entire program.

Solution:-

According to the problem

$n=O\left(n \log n\right)$. To see why, note that $n=O\left(n \logn\right)$ if and only if there exist positive constants $c$ and $n_{0}$ such that $n^{2} \leq c n \log ^{2} n$ for all $n \geq n_{0}$, which holds if and only if

\frac{n^{2}}{n \log ^{2} n} \leq c \quad \text { for all } n \geq n_{0}

By cancelling out an $n$ from the numerator and denominator, we can rewrite equation (1) as $n /\left(\log ^{2} n\right) \leq c$ for all $n \geq n_{0}$. Writing $n=n^{1 / 2} n^{1 / 2}$, we see that the last statement is true if and only if $\left[n^{1 / 2} /(\log n)\right]^{2} \leq c$ for all $n \geq n_{0}$. But because we know that $\log n=o\left(n^{1 / 2}\right)$, we have that $n^{1 / 2} /(\log n) \rightarrow \infty$ as $n \rightarrow \infty$, so $\left[n^{1 / 2} /(\log n)\right]^{2} \leq c$ cannot be true for all $n \geq n_{0}$ for any constant c.

Final Answer:-

The correct answer are  $\left[n^{1 / 2} /(\log n)\right]^{2} \leq c$ cannot be true for all $n \geq n_{0}$ for any constant c.

#SPJ2

Similar questions