A functional implementation of the garsia--wachs algorithm: (functional pearl)

  • Authors:
  • Jean-Christophe Filliatre

  • Affiliations:
  • Univ Paris Sud and INRIA Saclay - Ile-de-France, Orsay, France

  • Venue:
  • Proceedings of the 2008 ACM SIGPLAN workshop on ML
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

This functional pearl proposes an ML implementation of the Garsia-Wachs algorithm. This somewhat obscure algorithm builds a binary tree with minimum weighted path length from weighted leaf nodes with given inorder. Our solution exhibits the usual benefits of functional programming (use of immutable data structures, pattern-matching, polymorphism) and nicely compares to the purely imperative implementation from The Art of Computer Programming.