arXiv · 2512.21195
An O(nlogn) approximate knapsack algorithm
Abstract
A modified dynamic programming algorithm rapidly and accurately solves large 0/1 knapsack problems. It has computational O(nlogn), space O(nlogn) and predictable maximum error. Experimentally it's accuracy increases faster than linearly with the solution size k. Problems with k=1e3 are solved with an average maximum fractional error of 1e-4 and problems with k=1e5 with an average maximum fractional error of 1e-7. The algorithm runs in constant time for all problems with a given n. On a common desktop computer the algorithm processes n=1e3 problems in 1e-3 seconds and n=1e6 problems in 2 seconds.
Explore related subjects
Keep this discovery
Explore connections, maps & timelines
Nick Dawes. 2025-12-24. An O(nlogn) approximate knapsack algorithm. https://arxiv.org/abs/2512.21195
Cite the original work for its findings. Save a collection to share your selection of sources.