A greedy algorithm is a computational method that makes a series of choices, each of which looks best at the moment, with the aim of finding a global optimum. It works by selecting the locally optimal solution at each step with the hope that these local optima will lead to a global optimum.