Added greedy algorithm.