  Students of Computer Science often wonder when, exactly, one can apply a
greedy algorithm to a problem, and when one must use the more complicated and
time-consuming techniques of dynamic programming. This paper argues that the
existing pedagogical literature does not offer clear guidance on this issue. We
suggest improving computer science pedagogy by importing a concept economists
use in their own implementations of dynamic programming. That economic concept
is "opportunity cost," and we explain how it can aid students in
differentiating "greedy problems" from problems requiring dynamic programming
