Skip to main content

Inorder traversal of a binary heap and its inversion in optimal time and space

  • Conference paper
  • First Online:
Mathematics of Program Construction (MPC 1992)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 669))

Included in the following conference series:

Abstract

In this paper we derive a linear-time, constant-space algorithm to construct a binary heap whose inorder traversal equals a given sequence. We do so in two steps. First, we invert a program that computes the inorder traversal of a binary heap, using the proof rules for program inversion by W. Chen and J.T. Udding. This results in a linear-time solution in terms of binary trees. Subsequently, we data-refine this program to a constant-space solution in terms of linked structures.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Andersson, A., Catlsson, S.: Construction of a Tree from its Traversals in Optimal Time and Space. Information Processing Letters 34 (1990) 21–25

    Google Scholar 

  2. Bird, R.S.: Lectures on Constructive Functional Programming. Technical monograph PRG 69, Oxford University Computing Laboratory (1988)

    Google Scholar 

  3. Chen, W., Udding, J.T.: Program Inversion: More Than Fun! Science of Computer Programming 15 (1990) 1–13

    Google Scholar 

  4. Gabow, H.N., Bentley, J.L., Tarjan, R.E.: Scaling and related techniques for geometry problems. Proc. 16th Annual ACM Symposium on Theory of Computing (1984) 135–143

    Google Scholar 

  5. Gries, D.: Inorder Traversal of a Binary Tree. In: E.W. Dijkstra (ed.), The Formal Development of Programs and Proofs, Addison-Wesley, Amsterdam (1990)

    Google Scholar 

  6. Gries, D., v.d. Snepscheut, J.L.A.: Inorder Traversal of a Binary Tree and its Inversion. In: E.W. Dijkstra (ed.), The Formal Development of Programs and Proofs, Addison-Wesley, Amsterdam (1990)

    Google Scholar 

  7. Levcopoulos, Ch., Petersson, O.: Heapsort—Adapted for Presorted Files. In: F. Dehne, J.-R. Sack, N. Santoro (eds.), Algorithms and Data Structures, LNCS 382 (1989) 499–509

    Google Scholar 

  8. Vuillemin, J.: A unifying look at data structures. Communications of the ACM 23 (1980) 229–239

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

R. S. Bird C. C. Morgan J. C. P. Woodcock

Rights and permissions

Reprints and permissions

Copyright information

© 1993 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Schoenmakers, B. (1993). Inorder traversal of a binary heap and its inversion in optimal time and space. In: Bird, R.S., Morgan, C.C., Woodcock, J.C.P. (eds) Mathematics of Program Construction. MPC 1992. Lecture Notes in Computer Science, vol 669. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-56625-2_19

Download citation

  • DOI: https://doi.org/10.1007/3-540-56625-2_19

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-56625-0

  • Online ISBN: 978-3-540-47613-9

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics