Intuition for Greedy

Правка en1, от soda_bottle, 2020-12-12 00:01:25

Sometimes, problems have a greedy element associated with them. Once this observation/inference is made we can easily solve the problem using known techniques such as binary search/dynamic programming/brute force etc.
But often times, it is really difficult to prove such observations. We make an intelligent guess for example — "I infer that after all operations have been performed only odd numbers will be left in the array ..." — and kind of have trust that it will work. But, if unable to come up with a proof, people use different techniques such as writing a brute force to observe a pattern, or visualizing etc. to increase certainty of some statement being correct. Or in other times, people might just know the fact from a previous problem. Can people share their experiences in these situations? And workaround methods?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский soda_bottle 2020-12-12 00:01:25 876 Initial revision (published)