concept grid in category algorithms

appears as: grid, The grid
Grokking Algorithms: An illustrated guide for programmers and other curious people

This is an excerpt from Manning's book Grokking Algorithms: An illustrated guide for programmers and other curious people.

Here’s a practical example you can follow at home with a few pieces of paper and a pencil. Suppose you have to draw a grid of 16 boxes.

Every dynamic-programming algorithm starts with a grid. Here’s a grid for the knapsack problem.

The rows of the grid are the items, and the columns are knapsack weights from 1 lb to 4 lb. You need all of those columns because they will help you calculate the values of the sub-knapsacks.

The grid starts out empty. You’re going to fill in each cell of the grid. Once the grid is filled in, you’ll have your answer to this problem! Please follow along. Make your own grid, and we’ll fill it out together.