greedy algorithm proof examples