Dynamic Programming in Haskell | Lazy Evaluation | Infinite Data Structures

Поделиться
HTML-код
  • Опубликовано: 5 ноя 2024

Комментарии • 4

  • @johnpavel1913
    @johnpavel1913 3 года назад +4

    fibs = 1 : 2 : zipWith (+) fibs (tail fibs)

    • @crygnusproductions1660
      @crygnusproductions1660  3 года назад +9

      You are right. This is a much celebrated example implementation in Haskell. The reason I implemented fibonacci the way I did because I wanted to point out how close you can stay to the recursive definition and still implement a fast solution. It also helps to clarify the scaling up to multi dimensional DP. Cheers!

    • @myxail0
      @myxail0 Год назад

      @@crygnusproductions1660 yeah but this solution is O(n) and if I remember correctly (!!) is linear so your solution is quadratic. So dp in haskell stays bad

  • @hrtmtbrng5968
    @hrtmtbrng5968 Год назад

    This video has nothing to do with dynamic programming. The author has no idea what dynamic programming is. The video is nice, but the title does not fit.