138 points · by gone35 · 1y ago · 72 comments
I can imagine silly examples (like "find the minimum element in this list under the assumption that no more than O(sqrt(n)) elements exceed the minimum"...), but what's an interesting example of this?
What it and your example have in common is that a significant constraint exists on the input. I can't imagine how a deterministic algorithm with unconstrained input can process that input in sublinear time, but I would love to learn otherwise.
So I took it to mean there's something interesting here where the inputs could literally be anything, not heavily constrained. But I can't imagine what that might be.
I get what you're saying, and it doesn't change your point, but: no _way_ is binary search the first algorithm people learn. For binary search to even be intelligible you already have to know, at a minumum linear search and the concept of sorting (you probably know a sorting algorithm first). You also learn dozens of other really simple algorithms first in practice.
> there are classical optimization problems whose values can be approximated in sublinear time
This can actually be quite useful if the approximation is guaranteed, or even if it isn't, as long as it works well in practice.
https://www.dcs.warwick.ac.uk/~czumaj/PUBLICATIONS/DRAFTS/Dr...
Searching in sorted lists is the first example, although they acknowledge that "the assumption that the input array is sorted is not natural in typical applications." They then give an non-trivial variant of this problem, where the sorted list is stored as a linked list, so that you cannot directly jump to some element at position i.
Another example for a sublinear algorithm they give is to check whether 2 convex polygons intersect, using the algorithm by Chazelle and Dobkin.
And your first quote is followed by "However, for most natural problems", which further indicates that the known exact algorithms are for trivial problems.
The sublinear algorithms this page is discussing require that the algorithm not consider all elements of the data set and you're not allowed to pre-process it with an O(n) or greater algorithm.
So no trees, no binary search. It's a different set of algorithms.
Edit: Ah, GP asked for deterministic exact.
I have to assume the reason for the article wasn't to talk about the runtime of algorithms that operate on data that's already in a partially solved state.
A B-Tree would not qualify because it must first consider the entire input set. Only later operations can be less than O(n) because you've already done O(n) or greater work on the data set.
Any time I have information that reduces the entropy of the dataset, I want to be able to leverage that into runtime improvements of algorithms for pertinent questions. And it would be great to develop a structured framework for that instead of handling special cases in an ad-hoc manner.
Do you have any illustrative example so I can understand better what you are hinting at?
Cheers
Anyway, the point is that it's O(n/m) in the usual case. Which remains technically linear, not sub-linear; but at least it's O(n) with a constant factor smaller than 1.
State of the art there is poly-logarithmic time worst case.
> Anything probabilistic?
Are you sure you're answering the same question I'm asking?
I'd consider all the varieties of B-Tree to be real example, which goes to any DBMS. You can extend this out to any direction you want like logging for concrete examples.
GIS/Mapping/computer vision has tons of algorithms and data structures that all needed to do better than linear time as well.
Stream processing in general is another, but that ends up being probabilistic more often than not, so weak punt into that direction.
If you expand the use case out to sublinear space as well, I'd argue for compression of all kinds.
Also relevant: https://www.cs.yale.edu/homes/aspnes/pinewiki/Derandomizatio...
They were talking about not reading a lot of the input, so that's not it.
The input is the n(n-1)/2 bits indicating the results, but the existence of a winner can be determined in O(n) steps (fun exercise).
How is public opinion polling deterministic and exact?
To see why, realize that to determine x, the TM needs to look at x many bits. If this algorithm only needed, say, log(x) many bits to produce output then all input values with more than log(x) bits are indistinguishable by this TM.