Skip to main content
http -> https (the question was bumped anyway)
Source Link
Martin Sleziak
  • 4.7k
  • 4
  • 35
  • 40

Of course there can be no "worst" algorithm, since for any algorithm taking $p(n)$ steps on input of size $n$, we can easily design another algorithm taking $2^{p(n)}$ steps, which will be worse by the big-$O$ and big-$\Theta$ measures.

Meanwhile, the phenomenon of extremely long-running computations is naturally related to the phenomenon of fast-growing functions, such as the Ackermann diagonal functionAckermann diagonal function, whose values---and hence whose running times---are extremely large in comparison with conventional algorithms.

For example, here is an algorithm that is likely to be worse than any algorithm you may have considered. The problem is to determine, on input $n$, the $A(n)$-th digit of the decimal expansion of $\pi$, where $A(n)$ is the Ackermann diagonal function. On input $n$, my proposed algorithm would first compute $A(n)$, and then compute $\pi$ to that many digits, and then output the corresponding digit. The running time of this algorithm will exceed the Ackermann diagonal function, but it is not clear how one could improve the algorithm to make it faster.

But perhaps you meant to inquire merely about feasible algorithms, that is, algorithms that we will actually want to undertake. In this case, of course, even the exponential algorithms that seem to be required for NP problems would be too hard, and we would want to stay within the polynomial hierarchy. Even $n^3$ algorithms are not really feasible on large input.

(But indeed, I go further, if you are truly interested only in actually feasible, practical algorithms, then the big-$O$ and big-$\Theta$ concepts are not the right concept, since even constant time $O(1)$ algorithms can be unfeasible, if the constant is very large. The whole point of big-$O$ and big-$\Theta$ is to look at asymptotic behavior of the algorithms on extremely large input, and this takes us immediately out of the actually feasible category.)

Of course there can be no "worst" algorithm, since for any algorithm taking $p(n)$ steps on input of size $n$, we can easily design another algorithm taking $2^{p(n)}$ steps, which will be worse by the big-$O$ and big-$\Theta$ measures.

Meanwhile, the phenomenon of extremely long-running computations is naturally related to the phenomenon of fast-growing functions, such as the Ackermann diagonal function, whose values---and hence whose running times---are extremely large in comparison with conventional algorithms.

For example, here is an algorithm that is likely to be worse than any algorithm you may have considered. The problem is to determine, on input $n$, the $A(n)$-th digit of the decimal expansion of $\pi$, where $A(n)$ is the Ackermann diagonal function. On input $n$, my proposed algorithm would first compute $A(n)$, and then compute $\pi$ to that many digits, and then output the corresponding digit. The running time of this algorithm will exceed the Ackermann diagonal function, but it is not clear how one could improve the algorithm to make it faster.

But perhaps you meant to inquire merely about feasible algorithms, that is, algorithms that we will actually want to undertake. In this case, of course, even the exponential algorithms that seem to be required for NP problems would be too hard, and we would want to stay within the polynomial hierarchy. Even $n^3$ algorithms are not really feasible on large input.

(But indeed, I go further, if you are truly interested only in actually feasible, practical algorithms, then the big-$O$ and big-$\Theta$ concepts are not the right concept, since even constant time $O(1)$ algorithms can be unfeasible, if the constant is very large. The whole point of big-$O$ and big-$\Theta$ is to look at asymptotic behavior of the algorithms on extremely large input, and this takes us immediately out of the actually feasible category.)

Of course there can be no "worst" algorithm, since for any algorithm taking $p(n)$ steps on input of size $n$, we can easily design another algorithm taking $2^{p(n)}$ steps, which will be worse by the big-$O$ and big-$\Theta$ measures.

Meanwhile, the phenomenon of extremely long-running computations is naturally related to the phenomenon of fast-growing functions, such as the Ackermann diagonal function, whose values---and hence whose running times---are extremely large in comparison with conventional algorithms.

For example, here is an algorithm that is likely to be worse than any algorithm you may have considered. The problem is to determine, on input $n$, the $A(n)$-th digit of the decimal expansion of $\pi$, where $A(n)$ is the Ackermann diagonal function. On input $n$, my proposed algorithm would first compute $A(n)$, and then compute $\pi$ to that many digits, and then output the corresponding digit. The running time of this algorithm will exceed the Ackermann diagonal function, but it is not clear how one could improve the algorithm to make it faster.

But perhaps you meant to inquire merely about feasible algorithms, that is, algorithms that we will actually want to undertake. In this case, of course, even the exponential algorithms that seem to be required for NP problems would be too hard, and we would want to stay within the polynomial hierarchy. Even $n^3$ algorithms are not really feasible on large input.

(But indeed, I go further, if you are truly interested only in actually feasible, practical algorithms, then the big-$O$ and big-$\Theta$ concepts are not the right concept, since even constant time $O(1)$ algorithms can be unfeasible, if the constant is very large. The whole point of big-$O$ and big-$\Theta$ is to look at asymptotic behavior of the algorithms on extremely large input, and this takes us immediately out of the actually feasible category.)

Source Link
Joel David Hamkins
  • 236.5k
  • 44
  • 777
  • 1.4k

Of course there can be no "worst" algorithm, since for any algorithm taking $p(n)$ steps on input of size $n$, we can easily design another algorithm taking $2^{p(n)}$ steps, which will be worse by the big-$O$ and big-$\Theta$ measures.

Meanwhile, the phenomenon of extremely long-running computations is naturally related to the phenomenon of fast-growing functions, such as the Ackermann diagonal function, whose values---and hence whose running times---are extremely large in comparison with conventional algorithms.

For example, here is an algorithm that is likely to be worse than any algorithm you may have considered. The problem is to determine, on input $n$, the $A(n)$-th digit of the decimal expansion of $\pi$, where $A(n)$ is the Ackermann diagonal function. On input $n$, my proposed algorithm would first compute $A(n)$, and then compute $\pi$ to that many digits, and then output the corresponding digit. The running time of this algorithm will exceed the Ackermann diagonal function, but it is not clear how one could improve the algorithm to make it faster.

But perhaps you meant to inquire merely about feasible algorithms, that is, algorithms that we will actually want to undertake. In this case, of course, even the exponential algorithms that seem to be required for NP problems would be too hard, and we would want to stay within the polynomial hierarchy. Even $n^3$ algorithms are not really feasible on large input.

(But indeed, I go further, if you are truly interested only in actually feasible, practical algorithms, then the big-$O$ and big-$\Theta$ concepts are not the right concept, since even constant time $O(1)$ algorithms can be unfeasible, if the constant is very large. The whole point of big-$O$ and big-$\Theta$ is to look at asymptotic behavior of the algorithms on extremely large input, and this takes us immediately out of the actually feasible category.)