The difference between two lists, according to the "patience diff" algorithm.
Modulepatience-0.3Haskell2010
Patience
Implements "patience diff" and the patience algorithm for the longest increasing subsequence problem.
- 1 type
- 2 values
- Packagepatience-0.3
- Exports3
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourcePatience.hs
Patience diff
2 declarationsAn element of a computed difference.
Instances6Functor, Eq, Data, Ord, Read, Show
Functor ItemDefined in patience-0.3 · PatienceEq a => Eq (Item a)Defined in patience-0.3 · PatienceData a => Data (Item a)Defined in patience-0.3 · PatienceOrd a => Ord (Item a)Defined in patience-0.3 · PatienceRead a => Read (Item a)Defined in patience-0.3 · PatienceShow a => Show (Item a)Defined in patience-0.3 · Patience
Longest increasing subsequence
1 declarationGiven: a list of distinct integers. Picks a subset of the integers in the same order, i.e. a subsequence, with the property that
it is monotonically increasing, and
it is at least as long as any other such subsequence.
This function uses patience sort: http://en.wikipedia.org/wiki/Patience_sorting. For implementation reasons, the actual list returned is the reverse of the subsequence.
You can pair each integer with an arbitrary annotation, which will be carried through the algorithm.