4 ms·
A program that does not halt is not an algorithm. If you want to create a sorting algorithm, it has to halt, i.e. not run forever.
by crave_ 8y ago
A program that does not halt is not an algorithm. If you want to create a sorting algorithm, it has to halt, i.e. not run forever.
- candiodari 8y agoNot seeing that in either the definition and essentially all control algorithms, like say PID control, are meant to run "forever" (meaning longer than you can foresee in the code, they need an infinite loop)
- frabert 8y agoYou could consider that in PID control the actual algorithm is the single iteration, after which the output is sent out and a new set of inputs comes in, thus restarting the algorithm. In an endless iteration, you never give out any outputs
- candiodari 8y agoYou can't run PID in a single iteration. The integration and differentiation parts would be 0 in any single iteration, and so it's quite PID control if you look at it that way. The description of the algorithm doesn't make much sense in a single iteration either.