English

An O(nlogn) approximate knapsack algorithm

Data Structures and Algorithms 2025-12-30 v2

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.

Keywords

Cite

@article{arxiv.2512.21195,
  title  = {An O(nlogn) approximate knapsack algorithm},
  author = {Nick Dawes},
  journal= {arXiv preprint arXiv:2512.21195},
  year   = {2025}
}

Comments

8 pages: removed latex from metadata title and abstract to improve readability

R2 v1 2026-07-01T08:39:57.615Z