English

Discovering Algorithms with Matrix Code

Programming Languages 2012-05-09 v2

Abstract

In first-year programming courses it is often difficult to show students how an algorithm can be discovered. In this paper we present a program format that supports the development from specification to code in small and obvious steps; that is, a discovery process. The format, called Matrix Code, can be interpreted as a proof according to the Floyd-Hoare program verification method. The process consists of expressing the specification of a function body as an initial code matrix and then growing the matrix by adding rows and columns until the completed matrix is translated in a routine fashion to compilable code. As worked example we develop a Java program that generates the table of the first N prime numbers.

Keywords

Cite

@article{arxiv.1203.2296,
  title  = {Discovering Algorithms with Matrix Code},
  author = {M. H. van Emden},
  journal= {arXiv preprint arXiv:1203.2296},
  year   = {2012}
}

Comments

8 pages, 7 figures

R2 v1 2026-06-21T20:32:12.984Z