How to know that Greedy approach is wrong in some cases. Is there any general proof to check whether it's correct or not.How does one know that it's correct to apply Greedy approach in a given case.For example let us take minimum coins sum problem containing coins : 1,7,10.
So, For 15,Greedy approach gives 10,1,1,1,1,1. But optimal solution gives 7,7,1.Here greedy approach fails.But in some cases greedy approach gives correct result.So how to decide that greedy is good.I know that one answer is defenitely practise,but still are there any methods ?
↧
How does one know that Greedy approach is correct ?
↧