by lacker · 3y ago · 0 comments
That isn't possible, but it might not quite be obvious why that isn't possible.
To have sub-constant time it would have to go to 0 as n increases, as otherwise we could bound the time below by a constant. This isn't possible, as a computer will take at least 1 time unit on every input. So the expected time will always be at least 1.
If each piece of input is already independent, then you don't have to calculate that, you can just use the input in order.