Skip to content

Instantly share code, notes, and snippets.

@kunigami
Created July 9, 2017 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunigami/dcda12c63e268c967ccf67deb0d65386 to your computer and use it in GitHub Desktop.
Save kunigami/dcda12c63e268c967ccf67deb0d65386 to your computer and use it in GitHub Desktop.
(*
Binomial tree corresponding to a digit in the heap.
*)
type tree = Node of Element.t * tree list;;
type tv = Element.t
(*
A heap with n elements can be associated to the binary representation of
n. The 0's correspond to no tree, while the 1s in position i correspond to
trees with size 2^i
*)
type digit = Zero | One of tree;;
type schedule = digit stream list;;
type heap = {
digits: digit stream;
schedule: schedule;
};;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment