Greedy algorithm added in text