Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

How does one know that Greedy approach is correct ?

$
0
0

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 ?


Viewing all articles
Browse latest Browse all 39796

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>