
Faster Space-Efficient Algorithms for Subset Sum, K-Sum and Related Problems - kushti
https://arxiv.org/abs/1612.02788
======
nerdponx
How much better is this than prior art?

~~~
bradleyjg
In pure time terms it is worse, as the best prior was O$(2^.5n). However, that
algorithm took O$(2^.25n) space. This algorithm uses only polynomial space but
runs in O$(2^.86n) time. The naive solution runs in O$(2^n) and polynomial
space.

I believe this top line result will mostly be of interest to Computer
Scientists, as a practical matter these problems are rarely solved exactly
because even the fast algorithms are far too slow for non-trivial problem
sizes.

However, this part regarding the "list disjointment problem" may be of wider
interest:

"Underlying these results is an algorithm that determines whether two given
lists of length n with integers bounded by a polynomial in n share a common
value. Assuming random read-only access to random bits, we show that this
problem can be solved using O(log n) space significantly faster than the
trivial O(n^2) time algorithm if no value occurs too often in the same list."

N.B. The HN parser won't let me use stars, so read star for each of the dollar
signs in the first paragraph.

~~~
the8472
you could use the multiplication sign × or the middle dot ·

~~~
IanCal
The star here is not a multiplication. A bit more info on O star
[http://math.stackexchange.com/questions/672281/what-is-
the-d...](http://math.stackexchange.com/questions/672281/what-is-the-
difference-between-the-big-o-and-big-o-star-asterisk-operator)

~~~
the8472
Ah well, then there's the mathematical asterisk operator O∗ (U+2217) which is
separate from the ascii asterisk O* and you could also use the "combining
asterisk above" O ⃰ (O, whitespace, combining char) although that's probably
abuse of the characters.

The rules say

> Text surrounded by asterisks is italicized, if the character after the first
> asterisk isn't whitespace.

But apparently noen of the zero-width spaces are not counted as whitespace.

------
cschmidt
Subset sum is NP-complete
([https://en.wikipedia.org/wiki/Subset_sum_problem](https://en.wikipedia.org/wiki/Subset_sum_problem)),
so wouldn't this imply that P = NP? Hence, I don't believe it.

~~~
cschmidt
Sorry, looking at the paper, they aren't claiming a polynomial time solution,
so I retract my previous comment. They just claim "faster" than previous, but
still exponential.

The previous best was O _(2^(n /2)) time and O_(2^(n/4)) space, which they
improve to O*(2^(0.86n)) time and polynomial space.

~~~
vanderZwan
I must be missing something obvious, but how is 0.86n better than n/2 and n/4?

EDIT: I just noticed the space/polynomial space distinction, so I guess that's
the improvement, but I don't know what that means.

~~~
timtadh
From a purely practical standpoint it means it is more tractable to solve
large instances exactly. You can always wait for an answer but if you need
more memory than you have you are out of luck. For instance, let's say before
you had a problem of size 64. 2^64 bytes in gigabytes is 10^10 gigabytes. That
is more ram than I have. However, a constant multiple (say 1,000,000,000)
gives only 64 gigabytes. That takes an intractable problem to a tractable
problem on a server with a large amount of memory. Yes, you still have to wait
for the solution (maybe a long time) but at least you would have a hope of
actually solving it.

~~~
JadeNB
> You can always wait for an answer but if you need more memory than you have
> you are out of luck.

I'm not a practical programmer, so I may be off base, but it seems to me that
one could as well say "You can always buy more memory, but if the answer takes
more time than you have to wait then you're out of luck." (In both cases,
super-rapid growth won't take too long to exhaust the age, and the information
capacity, of the universe.) Is it really clear that it's better to err on the
side of more time in the time / space trade-off?

~~~
AstralStorm
No, because accessing memory also takes a lot of time. This is especially true
on small machines like cellphones.

