首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 109 毫秒
1.
递归在计算机科学和教学中都是一个重要的问题求解工具。利用递归算法可以用有限的语句来定义无限的集合,但在递归定义中必须有递归步骤的至少要有一条非递归的终止条件。在程序设计语言中,递归有多个应用,对于满足特定条件的某些问题,恰当地使用递归算法能使程序简捷、清晰易读,其结构也比较简练。  相似文献   

2.
本文分析了程序设计中递归算法执行速度慢的原因,提出了递归算法的非递归技术,此法计算速度很快,通用性较强,可用于改造一切使用递归方法设计的程序。  相似文献   

3.
<正>递归是计算机科学中极为重要的概念,递归调用技术在数据结构中获得了广泛的应用,所以对递归的研究是计算机科学领域中的重要课题.目前,国内文献对其技术和实现由递归往非递归算法的转化都有大量的介绍,对于由非递归往递归算法的转化较少.本文就此讨论了非递归算法的重要性和到递归算法的转换主要解决方法.1 递归和非递归问题一个对象部分地由自己组成或按它自己定义的则称为递归的.递归在自然界是经常要遇到的,众所周知,递归程序设计方法和实际问题的自然表达式相近,又特别符合于人们的思想习惯,具有容易设计,程序清晰易读等优点.因此,在程序设计中使用递归是十分有用的工具.  相似文献   

4.
递归在计算机科学和教学中都是一个重要的问题求解工具。利用递归算法可以用有限的语句来定义无限的集合,但在递归定义中必须有递归步骤的至少要有一条非递归的终止条件。在程序设计语言中,递归有多个应用,对于满足特定条件的某些问题,恰当地使用递归算法能使程序简捷、清晰易读,其结构也比较简练。  相似文献   

5.
递归算法结构简单、清晰,可读性好,且易于验证其正确性,但浪费空间且执行效率低。因此,有时需要把递归算法转换成非递归算法。本文给出几种递归算法的特点及相应非递归算法实现的方法。  相似文献   

6.
对递归程序的非递归作了较为深入的研究,给出了直接递归程序的非递归模板,提出了一个既适于直接递归程序,也适于间接递归程序的一般转化规则,并结合实例讨论了三类特殊情况下的递归转化方法。  相似文献   

7.
本针对二叉树的定义和结构特点.描述了三种遍历二叉树的递归算法.通过对其工作栈的状态分析,得出遍历二叉树的非递归算法,并由此算法给出了非递归遍历二叉树的C语言函数.  相似文献   

8.
递归调用是程序设计中一个非常重要的方法。本文对程序算法的递归调用及递归调用与非递归调用的转化从基本定义、实现过程及转化方法等几个方面进行了理论探讨,并结合实例做了进一步应用分析。此法简单直观,结构清晰.但计算机的执行过程比较复杂,时空性能相对较差。若在程序中消除递归调用,则其运行时间可大为节省。  相似文献   

9.
本文从递归算法的外在形式出发,将递归算法划分为三种情形,依递归算法的执行情况,得出递归算法的非递归化的策略:递归调用在算法尾部(返回语句除外)的情形,从上而下地递归到底,找到递归的终止条件,然后从下而上地用循环实现递归算法的非递归化;递归调用在中间时,依递归算法的执行情况,利用堆栈进行现场的保护与恢复,从而实现递归算法的非递归化;递归调用在中间的特殊情形,依递归算法的执行,将其转化为递归调用在尾部的情形。  相似文献   

10.
递归是程序设计和描述算法的一种有力的工具,递归是在数值计算、程序设计、数据结构、人工智能及其它领域应用广泛。从递归的算法分析以及公式化方法,讨论了递归程序设计的一般思想。  相似文献   

11.
Fibonacci数列(斐波那契数列)起源于兔子繁殖问题,因而也叫兔子数列。这是一个很重要的递推数列,受到了广泛而深入的研究。该文给出了几种计算Fibonacci数的数学方法,并对它们进行了比较。  相似文献   

12.
The results of qualitative and quantitative investigations conducted with individuals who learned algorithms in school are presented in this article. In these investigations, eye-tracking technology was used to follow the process of solving algorithmic problems. The algorithmic problems were presented in two comparable variants: in a pseudocode and flowchart. The eye-tracking data resulted in both qualitative (films registering the gaze paths) and quantitative measures, which allowed the detection and interpretation of the differences in the task-solving strategies between those who found the correct answer and those that did not. The results confirmed a hypothesis that use of the formal notation characteristic of a programming language for presenting algorithms is often a practical difficulty in the process of solving even simple tasks. This study opens a new direction of research; they show that eye-tracking technology can be used to optimise the educational process of learning programming.  相似文献   

13.
Conventional introduction to computer science presents individual algorithmic paradigms in the context of specific, prototypical problems. To complement this algorithm-centric instruction, this study additionally advocates problem-centric instruction. I present an original problem drawn from students' life that is simply stated but provides rich discussions of different approaches. It lends itself to a wide range of didactic means from individual or group study to whole class discussions under various levels of guidance by the instructor. I suggest diverse algorithms for solving it, covering some of the most important algorithmic paradigms. Some of these algorithms (greedy, divide-and-conquer) do not produce optimal solutions but may nevertheless have their merits in practice. The best algorithms are illustrative instances of some of the most sophisticated paradigms introduced in undergraduate curricula (dynamic programming, graphs).  相似文献   

14.
本文建立了物流中心选址双层规划模型,同时考虑到模型求解的需要,设计了模型的遗传算法求解算法,最后通过一算例验证了模型及其算法的可行性。  相似文献   

15.
In this paper, primal-dual interior-point algorithm with dynamic step size is implemented for linear programming (LP) problems. The algorithms are based on a few kernel functions, including both self-regular functions and non-self-regular ones. The dynamic step size is compared with fixed step size for the algorithms in inner iteration of Newton step. Numerical tests show that the algorithms with dynamic step size are more efficient than those with fixed step size. Project supported by Dutch Organization for Scientific Research (Grant No.613.000.010)  相似文献   

16.
汉诺塔问题迭代算法实现和分析   总被引:9,自引:0,他引:9  
本文实现了汉诺塔问题取代递归算法的迭代算法,介绍了它的递归算法和迭代算法的算法过程,并从算法占用存储单元和机器运行时间等方面对此两种算法进行了算法比较和分析。  相似文献   

17.
A set of basic construct Prolog schemata are presented as the basic constructs of a structured Prolog for recursive list processing. Prolog schema hierarchies are given that group classes of Prolog programs within each of the basic construct Prolog schemata via most-specific schemata which high-light their similarities and differences. A schema-based instructional approach based upon this classification of Prolog programs is provided as a method of introducing recursion to novice Prolog programmers. The incorporation of this approach to teaching recursive Prolog programming in an intelligent tutoring system is presented. Finally, a schema-based Prolog programming environment embedding this tutoring system in addition to a standard Prolog development system is proposed which promotes the acquisition and use of structured programming constructs in Prolog.  相似文献   

18.
从生活化的递归现象、数学化的递归公式、程序化的递归方法等三个层次,分析了递归问题的关键思维特征、数学递归模型和程序设计方法,并提出递归方法应用模式,最后应用该模式求解典型的递归问题。  相似文献   

19.
递归程序设计分析   总被引:1,自引:0,他引:1  
递归是解决一类问题的重要方法,通过递归程序设计实例,分析递归程序的时间和空间复杂度。给出递归程序适应的范围.  相似文献   

20.
The primary purpose of a programming language is to assist the programmer in the practice of her art. Each language is either designed for a class of problems or supports a different style of programming. In other words, a programming language turns the computer into a ‘virtual machine’ whose features and capabilities are unlimited. In this article, we illustrate these aspects through a language similar tologo. Programs are developed to draw geometric pictures using this language.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号