Deriving a Functional Knuth-Morris-Pratt Algorithm by Transformation

    • TAKEICHI MASATO
    • Department of Mathemetical Engineering and Information Physics, Faculty of Engineering, University of Tokyo
    • AKAMA YOJI
    • Department of Mathemetical Engineering and Information Physics, Faculty of Engineering, University of Tokyo

Abstract

We show how a functional program for the Knuth-Morris-Pratt algorithm can be derived from a naive algorithm in a few transformation steps. Included also is an implementation technique for efficient memo-ization. The idea behind the transformation is simple but novel and specific to functional programming; we use partial parametrization of higher-order functions and memo-jzation by data structures. Partial parametrization corresponds to precomputation, which is a common optimization technique in procedural programming, and memo-ization is similar to tabulation, which replaces an expensive computation by a simple table lookup. Mathematical reasoning is provided for the transformation rules.

Journal

Journal of information processing   [List of Volumes]

Journal of information processing 13(4), 522-528, 1991-02-10  [Table of Contents]

Information Processing Society of Japan (IPSJ)

Preview

Preview

Codes

  • NII Article ID (NAID) :
    110002673550
  • NII NACSIS-CAT ID (NCID) :
    AA00700121
  • Text Lang :
    ENG
  • ISSN :
    03876101
  • Databases :
    NII-ELS