Improve space efficiency for knapasck_bottom_up