Блог пользователя mandh_bhudhi_huon_me

Автор mandh_bhudhi_huon_me, история, 4 года назад, По-английски

Hello Everyone, I am having trouble with Greedy Technique. Though I can identify if the question is greedy but I am unable to start the solution Please help if you can with your experience it would be much help for coders like me. Thank You!!

  • Проголосовать: нравится
  • +12
  • Проголосовать: не нравится

»
4 года назад, # |
Rev. 4   Проголосовать: нравится +13 Проголосовать: не нравится
  1. Open problemset and search for greedy problems, with solution and rating.
  2. Choose the easy ones 1000-1200
  3. Try to figure out solution, if you failed to do it in 10m, read solution given by author.
  4. Try to implement solution, that you figured out/read. If you failed to do that in 30m, read implementation of autho. Try to understand why it works, and then try to write your own implementation again.
  5. Once you solved 5-6 problems of rank 1400, without looking at solution, you are done. Else return to step 3 with new problem to solve.

Bonus: Try to read and learn algorithms listed here: https://www.geeksforgeeks.org/greedy-algorithms/

»
4 года назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится
»
4 года назад, # |
Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

Adding to the comments, also try solving questions of tag constructive algorithms, it really helps in training your mind to prove your thesis, and most of the time, the solution is simplified to a simple greedy approach.

»
4 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

I always had problems with greedy algorithms, I would say that to use them you need that your solution make sense in your head, if it doesn't, I would say to just run away from them.