摘要
针对目前Word文档中尚不能自动绘制二叉树的问题,首先研究现有二叉树的一般绘制算法,比较分析Knuth、WS、TR等二叉树绘制算法,选取绘制效果好、效率高的TR算法应用于Word文档的二叉树自动绘制中。通过VBA编程设计绘制宏Draw Tree,从而实现了Word文档中二叉树的自动绘制。实验表明,只要给出二叉树的先序和后序序列,利用Draw Tree宏即可在Word文档中自动绘制出所需要的二叉树。
Aiming at the problem that the Word documents cannot automatically draw the binary tree at present yet, we first studied the existing general binary tree drawing algorithms, and compared and analysed some binary tree drawing algorithms such as Knuth, TR, WS, etc., then we selected TR algorithm, it has good drawing effect and high efficiency, to be applied in automatic binary tree drawing in Word documents. We designed the drawing macro DrawTree with VBA programming,thus achieved the automatic binary tree drawing in Word documents. Experiments showed that as long as the first order and post order sequences of a binary tree are given, the conceived binary tree can be drawn automatically in Word documents by using macro DrawTree.
出处
《计算机应用与软件》
CSCD
2016年第12期230-233,共4页
Computer Applications and Software
基金
国家自然科学青年科学基金项目(41405083)
湖南省教育厅教改项目(湘教通(2014)247号-465)
关键词
静态链表
绘树算法
VBA宏
WORD文档
Static linked list
Algorithm of drawing tree
Visual Basic for Applications
Word document