modified:   greedy.c