An anytime algorithm is an algorithm that can return a valid solution even if it is interrupted before completing its full computation. Its output quality is expected to improve as more time or computational resources are available.
An algorithm that can return a valid solution to a problem even if it is interrupted before it ends.