optimized selectGreedy