local greedy algorithm added