Skip to content

Instantly share code, notes, and snippets.

View neoGeneva's full-sized avatar

Philip Cox neoGeneva

  • Wellington, New Zealand
View GitHub Profile
@neoGeneva
neoGeneva / RedBlackTree.fsx
Created June 30, 2011 11:13
Red-Black Tree in F#
// Inspired by: http://jng.imagine27.com/articles/2011-06-28-141124_purely_functional_types_red_black_trees_in_qi.html
type TreeNode<'a> = { Key: int; Val: 'a }
type Color = Red | Black
type Tree<'a> = { Color: Color; LTree: Tree<'a> option; TreeNode: TreeNode<'a>; RTree: Tree<'a> option; }
let makeTreeBlack tree =
match tree with