Piggy Bank is a simple variant of exact knapsack problem in which you can select more than 1 quantities of an item.
❱❱ kp[x - 1][y], kp[x][y] ❱❱ minimum of ❱❱ ❱❱❱ kp[x - 1][y - w[x]], ❱❱ kp[x][y - w[x]],
and C++ is a stupid language but unfortunately it is fast and has stl.
How am I supposed to be aware that I have to allocate memory in the heap every time when I’m dealing with array sizes >= 100000. A language can expect a user to be familiar with a lot design practices but it shouldn’t expect him to be aware of what’s happening in the black box all the time!. today I got a SIGSEGV for trying to allocate memory on stack instead of heap. For 2 Hours I thought there is something wrong with my algorithm and later working with Valgrind confirmed that there are no leaks and then found this stupid stack, heap thing.