Efficient table for Dynamic Programming in Haskell

后端 未结 5 1669
青春惊慌失措
青春惊慌失措 2021-01-31 06:03

I\'ve coded up the 0-1 Knapsack problem in Haskell. I\'m fairly proud about the laziness and level of generality achieved so far.

I start by providing functions for crea

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 06:43

    Lazy storable vectors: http://hackage.haskell.org/package/storablevector

    Unbounded, lazy, O(chunksize) time to construct, O(n/chunksize) indexing, where chunksize can be sufficiently large for any given purpose. Basically a lazy list with some significant constant factor benifits.

提交回复
热议问题