Recursive and Nonrecursive Traversal Algorithms for Dynamically Created Binary Trees

来源 :Computer Technology and Application | 被引量 : 0次 | 上传用户:zhengyicai2010
下载到本地 , 更方便阅读
声明 : 本文档内容版权归属内容提供方 , 如果您对本文有版权争议 , 可与客服联系进行内容授权或下架
论文部分内容阅读
  Abstract: The modeling of dynamical systems from a time series implemented by our DSA program introduces binary trees of height with all leaves on the same level, and the related subtrees of height . These are called trees and subtrees. The recursive and nonrecursive versions of the traversal algorithms for the trees with dynamically created nodes are discussed. The original nonrecursive algorithms that return the pointer to the next node in preorder, inorder and postorder traversals are presented. The space-time complexity analysis shows and the execution time measurements confirm that for these algorithms, the recursive versions have approximately 10-25% better time constants. Still, the use of nonrecursive algorithms may be more appropriate in several occasions.
  Key words: Binary-trees, algorithms, tree traversal, preorder, inorder, postorder, recursive, nonrecursive, space-time complexity.
  1. Introduction
  The choice and comparison of recursive versus nonrecursive algorithms is a known subject from the algorithm-study in computer science. It is found in the major textbooks, it is investigated by scientists, and discussed by professionals. In this paper we present the design and complexity analysis of a few testing and practical functions that do their job on dynamically created tree nodes by using both recursive and nonrecursive tree traversal algorithms.
  The implementation of the algorithms and their testing is done within our DSA (Dynamical Systems Automata) program for the modeling of dynamical systems from a time series, based on J. P. Crutchfield’s theory of ?-machines [1]. In [2] we have presented the outline and some interesting aspects of the theory for the readers from the computing area. The resulting dynamical system models are based on the stochastic finite automata, which are analogous to the finite automata from the theory of computation. As such, the modeling scheme turns out to be an intriguing programming challenge from the perspective of computer science. Quite general structural and algorithmic problems were addressed during the development of the DSA modeling tool, which are interesting for their design analysis and efficiency testing. From quite a few of them, here we concentrate on the tree structures and the algorithms that traverse through, and operate on, their nodes.
  References
  [1] J.P. Crutchfield, Computational Mechanics Publications, available online at: http://csc.ucdavis.edu/~chaos/chaos/pub s.htm, accessed: April 2012.
  [2] R. Logozar, A. Lovrencic, The modeling and complexity of dynamical systems by means of computation and information theories, Journal of Information and Organizational Sciences 35 (2) (2011).
  [3] E. Horowitz, S. Sahni, Fundamentals of Computer Algorithms, Pitman Publish Ltd., London, 1979.
  [4] N. Wirth, Algorithms & Data Structures (New Edition), Prentice/Hall International, London, 1986.
  [5] A.B. Tucker at al., Fundamentals of Computing II, C++ Edition, McGraw-Hill, New York, 1995.
  [6] A.V. Aho, J.E. Hopcroft, J.D. Ullman, The Design and Analysis of Computer Algorithms, Addison-Wesley, Reading, Massachusetts, 1974.
  [7] R. Logozar, Modeling of dynamical systems by stochastic finite automata, Master Thesis, Faculty of Electrical Engineering and Computing, University of Zagreb, 1999.
其他文献
大豆高产栽培过程中,郁蔽倒伏造成捂花捂荚,一般减产10%以上。通过应用植物生长调节剂(TK-50抗倒伏增产素或乙烯利),对大豆植株进行化学调控,比对照增产6.9-21.5%,保花荚、防倒
新疆处于我国的西北边陲,区内山脉纵横,河流湖泊交错分布,水量在时空分布上处于十分不均衡的状态,如何充分利用水资源,调节水量分布,保障和促进农业生产,一直是水利和农业工
摘要:杨树枝干害虫,俗称林木的“内伤”,具有很强的隐蔽性、潜伏性和毁灭性。文章介绍了为害杨树主要枝干害虫的种类和生活习性,并提出了切实可行的防治措施。  关键词:杨树枝干害虫;生活习性;防治技术  中图分类号:S763.3文献标识码:A文章编号:1674-0432(2010)-09-0072-1    随着各项造林工程的深入开展,我市杨树幼龄林面积在不断增加。然而,杨树枝干害虫对幼树的为害也逐年加