Rotate and Double

  • A. N. Habermann
Part of the Texts and Monographs in Computer Science book series (MCS)

Abstract

The program developed in this paper solves the problem of finding numbers X such that 2X = Y, where Y is derived from X by right-rotating X one digit position so that the rightmost digit becomes the leftmost digit. The problem is particularly interesting because it has vastly different solutions for number systems other than the decimal system. The developed program has the characteristic that, while it is not difficult to design, it requires a non-trivial proof of termination. This makes the development a nice candidate for demonstrating the merit of Dijkstra’s “separation of concerns.” Once termination is proven, we gain so much insight into the program that it can be substantially improved. Finally, analysis of the “useful” solutions leads to another version and an even more significant improvement in performance.

Keywords

Assure Prefix Dick Mellon 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    E. W. Dijkstra. On the role of scientific thought. In Selected Writings on Computing: A Personal Perspective, page 60, Springer-Verlag, New York, 1982.Google Scholar
  2. [2]
    H. Loonstra. Inleiding tot de Algebra. P. Noordhof, Groningen, 1968.Google Scholar

Copyright information

© Springer-Verlag New York, Inc. 1990

Authors and Affiliations

  • A. N. Habermann
    • 1
  1. 1.School of Computer ScienceCarnegie Mellon UniversityPittsburghUSA

Personalised recommendations