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.
Copyright © A. N. Habermann This work was supported in part by the ZTE division of Siemens Corporation, Munich, Germany and by a grant from Westinghouse Corporation, Pattsburgh, Pennsylvania.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
E. W. Dijkstra. On the role of scientific thought. In Selected Writings on Computing: A Personal Perspective, page 60, Springer-Verlag, New York, 1982.
H. Loonstra. Inleiding tot de Algebra. P. Noordhof, Groningen, 1968.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1990 Springer-Verlag New York, Inc.
About this chapter
Cite this chapter
Habermann, A.N. (1990). Rotate and Double. In: Feijen, W.H.J., van Gasteren, A.J.M., Gries, D., Misra, J. (eds) Beauty Is Our Business. Texts and Monographs in Computer Science. Springer, New York, NY. https://doi.org/10.1007/978-1-4612-4476-9_18
Download citation
DOI: https://doi.org/10.1007/978-1-4612-4476-9_18
Publisher Name: Springer, New York, NY
Print ISBN: 978-1-4612-8792-6
Online ISBN: 978-1-4612-4476-9
eBook Packages: Springer Book Archive