beta
add greedy algorithm