Skip to content

Instantly share code, notes, and snippets.

@kunigami
Created July 9, 2017 01:27
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/cb73ebc8d9a69e766b64a28fa087359d to your computer and use it in GitHub Desktop.
Save kunigami/cb73ebc8d9a69e766b64a28fa087359d to your computer and use it in GitHub Desktop.
(*
Inserts an element in the heap.
*)
let insert (elem: tv) (heap: heap): heap =
match heap with {digits; schedule} ->
let newDigits = insertTree (Node (elem, [])) digits in
let newSchedule = execSchedule (newDigits :: schedule) in
{digits = newDigits; schedule = newSchedule}
;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment