Updated greedy.c