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

Автор antivenom, история, 9 лет назад, По-английски

Hello everyone,I am new to Dynamic programming and what I have observed that in any question whenever I think that this is a permutation combination question,it comes out to be a DP.So my question from you guys is that is permutation and combination Dp in competitive coding.Like this question I thought of P&C but its a Dp

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

»
9 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Combinations and DP are closely related: C(n, k) = C(n - 1, k - 1) + C(n - 1, k).

Usually you only need to think about combinations when you have to optimize from O(n2) to O(n). Then you can use the factorial formula to find C(n, k) in constant time with O(n) precomputation.

  • »
    »
    9 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    So one must be good in Combinations in order to get better fast and furious way in DP ?

    • »
      »
      »
      9 лет назад, # ^ |
        Проголосовать: нравится +11 Проголосовать: не нравится

      No , combinatorics help only in counting problems while dp can help also in a lot of minimization and maximization problems so there's a lot of kinds of dp that have nothing to do with combinatorics