greedy algorithm in daa with example