GreedyAlgorithm refactoring
Fixed greedy algorithm bugs.