## Inorder Traversal of a Binary Heap and its Inversion in Optimal Time and Space (1992)

Venue: | Mathematics of Program Construction, volume 669 of Lecture Notes in Computer Science |

Citations: | 5 - 0 self |

### BibTeX

@INPROCEEDINGS{Schoenmakers92inordertraversal,

author = {Berry Schoenmakers},

title = {Inorder Traversal of a Binary Heap and its Inversion in Optimal Time and Space},

booktitle = {Mathematics of Program Construction, volume 669 of Lecture Notes in Computer Science},

year = {1992},

pages = {291--301},

publisher = {Springer-Verlag}

}

### OpenURL

### 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. 1

### Citations

1335 | The essence of functional programming
- Wadler
- 1992
(Show Context)
Citation Context ...ications. For example, the “largest rectangle under a histogram” can easily be computed once the histogram—which is just a list of natural numbers— has been converted into the corresponding heap (see =-=[2]-=-). Other applications of these heaps can be found in [4], which also contains a description of a linear-time conversion algorithm. In [4] the heaps are called “Cartesian trees” after Vuillemin, who in... |

181 | Scaling and related techniques for geometry problems - Gabow, Bentley, et al. - 1984 |

98 | A unifying look at data structures - Vuillemin - 1980 |

4 | and Svante Carlsson, Construction of a tree from its traversals in optimal time and
- Andersson
- 1990
(Show Context)
Citation Context ...edures C2 and C3 we see that they are optimal with respect to time as well as space. We have found a similar result for the reconstruction of a binary tree from its preorder and inorder traversals in =-=[1]-=-. We remark that the latter result may also be achieved by refining the algorithm derived—by program inversion—in [3]. Compared to the way this result is achieved in [1], we observe that such an appro... |

4 |
Heapsort-Adapted for Presorted Files
- Levcopoulos, Petersson
- 1989
(Show Context)
Citation Context ...d 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. 1 Introduction In =-=[7]-=- an elegant sorting algorithm is presented which exploits the presortedness of the input sequence. The first step of this variant of Heapsort comprises the conversion of the input sequence in a “mintr... |

2 |
Construction of a Tree from its Traversals
- Andersson, Carlsson
- 1990
(Show Context)
Citation Context ...edures C2 and C3 we see that they are optimal with respect to time as well as space. We have found a similar result for the reconstruction of a binary tree from its preorder and inorder traversals in =-=[1]-=-. We remark that the latter result may also be achieved by refining the algorithm derived---by program inversion---in [3]. Compared to the way this result is achieved in [1], we observe that such an a... |

1 |
J.T.: Program Inversion: More Than Fun
- Chen, Udding
- 1990
(Show Context)
Citation Context ...inverse problem,” i.e., it computes the inorder traversal of a binary heap in linear time. To guarantee the correctness of this inversion, we apply the proof rules given by W. Chen and J.T. Udding in =-=[3]-=-. These proof rules support stepwise program inversion. Subsequently, in the second step, we refine this algorithm to a program that operates on linked structures instead of binary trees. Just as in [... |

1 | Tarjan R.E.: Scaling and related techniques for problems - Gabow, Bentley - 1984 |

1 |
J.L.A.: Inorder Traversal of a Binary Tree and its Inversion
- Gries, Snepscheut
- 1990
(Show Context)
Citation Context ... first solve the “inverse problem:” given t, satisfying H.t ∧ t = S, construct an O(#S) program with postcondition s = S. Since this problem has been solved in a neat way already many times (e.g., in =-=[5, 6, 3]-=-), we merely present a solution without derivation. In each of the programs in [5, 6, 3], a list of trees, which we name q, is used, and the loop invariant is something like s + t + q = S, (P0) where ... |

1 |
Inorder Traversal of a Binary Tree
- Gries
- 1990
(Show Context)
Citation Context ...ll first solve the "inverse problem:" given t, satisfying H:tst = S, construct an O(#S) program with postcondition s = S. Since this problem has been solved in a neat way already many times =-=(e.g., in [5, 6, 3]-=-), we merely present a solution without derivation. In each of the programs in [5, 6, 3], a list of trees, which we name q, is used, and the loop invariant is something like s ++ t ++ q = S ; (P0) whe... |