Skip to main content

All Questions

Tagged with
3 votes
0 answers
96 views

Unique Distancing Problem, Memoization in Haskell

note: You might be scared seeing the length of the post, but it's actually not that long because you don't need to read the compiler logs or the python code to understand my code (I wish StackExchange ...
Benoît P's user avatar
  • 799
5 votes
2 answers
704 views

Calculating the count of integer partitions of a number (uses stateful vectors internally)

I've written a Haskell function to count the number of partitions of an integer - it's basically an implementation of the same algorithm as this one, using Euler's Pentagonal Number Theorem: $$P(n) = ...
phlummox's user avatar
  • 218
4 votes
2 answers
1k views

Memoized Collatz sequence

Here is one of my programs that utilized memoization and array to improve performance and memory usage. The performance seems satisfactory but the memory usage is ridiculous and I can't figure out ...
Jason Hu's user avatar
  • 143
13 votes
1 answer
2k views

Detecting cycles in a directed graph without using mutable sets of nodes

I recently came across the classic algorithm for detecting cycles in a directed graph using recursive DFS. This implementation makes use of a stack to track nodes currently being visited and an extra ...
John Tyree's user avatar
5 votes
1 answer
203 views

Levenshtein Distance with Haskell Vectors and Memoization

Is the following an effective way to implement the Levenshtein Distance with Haskell vectors? ...
ana's user avatar
  • 51