计算机应用与软件2018,Vol.35Issue(5):10-14,84,6.DOI:10.3969/j.issn.1000-386x.2018.05.002
九宫八数问题的四种深度优先编程方法
THE FOUR DEPTH-FIRST PROGRAMMING METHODS OF THE EIGHT-NUMBER AND NINE-GRID PROGRAM
摘要
Abstract
Optimized programming on the storage mode of the grid matrix and mobile path can effectively improve the time complexity and space complexity of the ″eight-number and nine-grid ″programming.The paper provides two C language programming and compares the method of ″square matrix storage″and ″string storage method″.Experimental data analysis shows that the ″string storage method″is superior to the ″square matrix storage method″in the time-space efficiency of the program.In addition,a programming method is proposed to establish path identification matrix,which can simplify programming code and improve readability.It also proposes a recursive programming method of retaining path information,which can effectively reduce the recursive stack space,significantly reduce program space complexity, reduce program running time,and improve program efficiency.关键词
九宫八数问题/深度优先编程方法/方阵存储法/字串存储法/路径标识矩阵/时空复杂度Key words
Eight-number and nine-grid program/Depth-first programming method/Square matrix storage method/String storage method/Path identification matrix/Space time complexity分类
信息技术与安全科学引用本文复制引用
马旭..九宫八数问题的四种深度优先编程方法[J].计算机应用与软件,2018,35(5):10-14,84,6.基金项目
国家自然科学基金项目(11304135) (11304135)
辽宁省自然科学基金项目(201602345). (201602345)