Hazemzz's blog

By Hazemzz, history, 8 years ago, In English

i always have a problem with all greedy problem that is not easy to see its optimal choice ?

some times i get an intuition but i am not sure it works 100% how would i improve my proving skills for greedy .would i try my intuition with code and check if it will get a WA or not ? some tips from you please .

  • Vote: I like it
  • +1
  • Vote: I do not like it

»
8 years ago, # |
Rev. 3   Vote: I like it +26 Vote: I do not like it

Code your greedy, code a naive working code, test if for a lot of random (small) inputs. Check if your greedy code is working fine. It reduces the chance of getting WA.

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Without proving it ?

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      It's usually easier to just test the greedy code than to actually prove it.