A note on the nonrecursive traversal of binary trees
Open Access
- 1 January 1977
- journal article
- Published by Oxford University Press (OUP) in The Computer Journal
- Vol. 20 (4) , 350-352
- https://doi.org/10.1093/comjnl/20.4.350
Abstract
A nonrecursive procedure is developed for traversing unthreaded binary trees in a fixed space and in time proportional to tree size. Burkhard (1975) gives a way to do this without requiring a tag field, but with the requirement that descendent nodes have greater addresses than parents. Knuth (1968) gives a way to do such a traverse but requires a tag field. This paper develops one program that realises either variation (for preorder, symmetric order or endorder traversal for tagged or ordered trees). The development is based on a careful, stepwise rewriting of a simple traversal program, confirming Knuth's claim (1974) that program manipulation is a useful technique for program development.Keywords
This publication has 0 references indexed in Scilit: