added dynamic and greedy algorithms