Daily Haskell Exercise: Column Minima in a totally monotone matrix
Column Minima in a totally monotone matrix
Let type Matrix a = Int->Int->a
to denote a matrix.
The SMAWK algorithm solves this problem. Here is an video which features the algorithm around 37 minutes into the video. David Eppstein have a python implementation of the algorithm.
Implement columnMinima :: Ord a => Matrix a->Int->Int->[Int]
, which takes a totally monotone matrix with it's width and height, it find the list of column minima's row position.
Read full article from Daily Haskell Exercise: Column Minima in a totally monotone matrix
No comments:
Post a Comment