Probably not what you want, but another option is caching the results after computing them for the first time. If you have large enough memory, and you get the same questions asked repeatedly, only the first time will be expensive, and afterwards it will be O(1), which means that cost will converge to O(1) over time.
Probably not what you want, but another option is caching the results after computing them for the first time. If you have large enough memory, and you get the same questions asked repeatedly, only the first time will be expensive, and afterwards it will be O(1), which means that cost will converge to O(1) over time.