Algorithm |
- Assume optimal partitioning for the first i values with at most
bins is ![](images/img882.png)
|
- Consider placement of the last bin
|
- Choice is any of the i gaps
|
- For each such placement at gap
, at most bins have been placed optimally for the first values
|
- This leads to the recursion
|
|
- Dynamic programming (DP) solution
|
- Table of size
![](images/img885.png)
|
- Start with cell
and proceed in a column-scan order
|
- Computation for cell
requires values at cells ![](images/img888.png)
|