This paper is concerned with the general dynamic lot size model, or (generalized) Wagner-Whitin model. Let n denote the number of periods into which the planning horizon is divided. The authors describe a simple forward algorithm which solves the general model in O(nlogn) time and O(n) space, as opposed to the well-known shortest path algorithm advocated over the last 30 years with O(n2) time. A linear, i.e., O(n)-time and space algorithm is obtained for two important special cases: (a) models without speculative motives for carrying stock, i.e., where in each interval of time the per unit order cost increases by less than the cost of carrying a unit in stock; (b) models with non-decreasing setup costs. The authors also derive conditions for the existence of monotone optimal policies and relate these to known (planning horizon and other) results from the literature.