Figure 1:
Flow chart of greedy algorithm.