greedy method in daa subject