计算机应用与软件2018,Vol.35Issue(4):122-128,7.DOI:10.3969/j.issn.1000-386x.2018.04.023
基于状态机的递归算法非递归化框架
NON-RECURSIVE CONVERSION FRAMEWORK OF RECURSIVE ALGORITHM BASED ON STATE MACHINE
摘要
Abstract
Converting recursive algorithms to non-recursive ones can avoid the error of stack overflow and improve algorithm running efficiency.Thus,a conversion framework,which is benefit from state machine,is proposed.In this framework,the actions of function calling and returning are considered as state transition,and the recursive procedures are encoded by "entering function","entering recursive point" and "returning from recursive point" et al.In experiments,the conversions of several classic recursive algorithms show that,compared with the framework of "while-while" or "while-if" et al.,the proposed framework has the advantages of clear structure,compact codes,and more programmatic conversion procedure.关键词
状态机/栈/递归算法/非递归算法/框架Key words
State machine/Stack/Recursive algorithm/Non-recursive algorithm/Framework分类
信息技术与安全科学引用本文复制引用
杨硕,周霜菊,张志杰..基于状态机的递归算法非递归化框架[J].计算机应用与软件,2018,35(4):122-128,7.基金项目
成都大学龙泉驿区汽车创意设计试点区项目(2015-CX00-00010-ZF) (2015-CX00-00010-ZF)
辽宁省教育厅基金项目(L2014171) (L2014171)
四川省科技支撑计划项目(2016GZ0396). (2016GZ0396)