• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊
论文

后序遍历二叉树非递归算法的推导及形式化证明

  • 左正康 ,
  • 游珍 ,
  • 薛锦云
展开
  • ( 江西师范大学省高性能计算技术重点实验室,江西 南昌 330022)
左正康(1980),男,江西临川人,博士生,讲师,CCF学生会员(E20009770G),研究方向为软件形式化;游珍,硕士生;薛锦云,教授,博士生导师。

收稿日期: 2008-03-24

  修回日期: 2009-07-06

  网络出版日期: 2010-03-10

Derivation and Formal Proof of NonRecursive Postorder BinaryTree Traversal Algorithm

  • ZUO Zheng-Kang ,
  • LIU Zhen ,
  • XUE Jin-Yun
Expand
  • (Key Laboratory for HighPerformance Computing Technology,Jiangxi Normal University,Nanchang 330022)

Received date: 2008-03-24

  Revised date: 2009-07-06

  Online published: 2010-03-10

摘要

开发涉及非线性数据结构算法程序的循环不变式一直是形式化方法的难点。本文使用PAR方法开发循环不变式的新策略,对后序遍历二叉树问题循环不变式的开发使用递归定义技术,得到了该问题循环不变式的简单精确的表达形式,简化了算法程序的推导和证明过程;利用PAR平台提供的抽象程序设计语言Ap1a中的数据抽象机制,使所得的算法程序结构简洁清晰且易于证明;最后,使用DijkstraGries标准程序证明法形式证明了该问题的核心算法程序(只有4行代码),并使用PAR平台将Apla程序转换成正确的C++代码。实例的成功进一步说明PAR方法提供的循环不变式的开发技术对推导和证明非线性数据结构算法程序的有效性。

本文引用格式

左正康 , 游珍 , 薛锦云 . 后序遍历二叉树非递归算法的推导及形式化证明[J]. 计算机工程与科学, 2010 , 32(3) : 119 -123 . DOI: 10.3969/j.issn.1007130X.2010.

Abstract

Developing loop invariants of algorithms containing nonlinear data structure is generally regarded as a difficult problem. In this paper, new strategies for developing loop invariant are introduced, and an exact and simple loop invariant of the nonrecursive postorder binarytree traversal algorithm is worked out by adopting the recursive definition technique of loop invariants and ideas of partitionandrecur. The approach considerably simplifies the process of derivation and proof of the nonrecursive algorithm and avoids the blindness of developing the loop invariant. Using datatype abstraction of Apla language, which is a part of PAR, the result algorithmic program is pretty concise and easy to be proved. Finally, the core algorithm (just 4 lines in Apla) is successfully proved by DijkstraGries standard proving technique, and the abstract program is transformed into C++ program by PAR platform. It is demonstrated that the recursive definition technique of loop invariant is feasible and effective for deriving and proving nonlinear data structure algorithms.
文章导航

/