bug fix in prob1 for greedy algo