When piling a set of items in a single stack, one often does not pay attention to the order. Real-life experience suggests that, whenever a specific item is suddenly requested, we need to dig very deep into the stack to extract it.In this paper we investigate stack reordering strategies aiming at minimizing the number of "pop" and "push" operations. In particular we focus on three versions of the problem in which reordering can take place in different phases: when unloading the stack, when loading it or in both phases.We show that the first two variants can be solved in linear time, while for the third one we devise a dynamic programming method with quadratic complexity.
The stack loading and unloading problem / F., Malucelli; S., Pallottino; Pretolani, Daniele. - In: DISCRETE APPLIED MATHEMATICS. - ISSN 0166-218X. - STAMPA. - 156:(2008), pp. 3248-3266. [10.1016/j.dam.2008.05.020]