A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
This is a python implementation of a subset sum algorithm by Konstantinos Koiliaris and me.
Given a set of n positive integers, the algorithm finds all the values t<=u such that there exists a subset that sums to t.
The running time is O(sqrt(n)u) with some extra polylog factors.
There is also a C++ implementation of the standard dynamic programming algorithm for subset sum. The DP table gets packed into 64 bit unsigned integers. It's probably the fastest possibe implementation of the O(nu) time algorithm without getting into ASM and parallelism.