Integrate and implement Greedy algorithm