Greedy algorithms and activity scheduling