A dynamic programming approach for sequencing a given set of jobs in a single machine is developed, so that the total processing cost is minimized. Assume that there are N distinct groups of jobs, where the jobs within each group are identical. A very general, yet additive cost function is assumed. This function includes the overall completion time minimization problem as well as the total weighted completion time minimization problem as special cases. Priority considerations are included; no job may be shifted by more than a prespecified number of positions from its initial, first come-first served position in a prescribed sequence. The running time and the storage requirement of the dynamic programming algorithm are both polynomial functions of the maximum number of jobs per group, and exponential functions of the number of groups N.