Tag: #haskell
Is there a route between these two nodes in this directed graph?
An algorithm in Haskell using a breadth-first search to find the reachable set of nodes. 2020-01-24
How to check if a binary tree is balanced
An O(n) algorithm to check if a binary tree is balanced, by passing up the height from recursive calls. 2020-01-23
How to sort a stack using one additional stack
We can model “infinite tape” using two stacks. Then we can navigate the list in both directions. This lets us bubble-sort the list in O(n^2) time. 2020-01-22
Implementing a queue using two stacks
Implement a queue using two stacks, with one stack for the back of the queue and one for the front. Reverse the back stack onto the front stack when dequeuing to maintain the queue order. 2020-01-21
Towers of Hanoi in Haskell
A Haskell solution to the classic Towers of Hanoi problem. 2020-01-20
How to check whether a linked list is a palindrome
Find the middle node of the linked list using the “runner” trick. Reverse the first half, then compare the nodes pairwise from the middle outwards. Restore the list to its original state before returning. 2020-01-16
Writing a parser in Haskell
I write a parser for JimScript, an imperative programming language, in Haskell. The parser goes through three stages: tokenization, nesting, and parsing. 2018-03-09
An interpreter in Haskell
An interpreter for an imperative language in Haskell, featuring integers, operators, global variables, control flow, and I/O primitives. 2018-03-06
Low latency, large working set, and GHC’s garbage collector: pick two of three
Large working sets and low latency are incompatible with GHC’s stop-the-world garbage collector, which optimizes for throughput instead of latency. The collector’s pause times scale linearly with working set size. 2016-05-12
A proposal for visual pure functional programming
A visual programming language inspired by Haskell. 2012-02-27
All content copyright James Fisher.