首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 171 毫秒
1.
递归算法简单自然、结构清晰、易写易读、易于验证其正确性,但执行效率不高。因此,在程序设计中,通常对所要处理的问题先用递归算法加以描述,然后再将其改写成非递归算法。本文从四个方面论述了递归算法的模拟问题。  相似文献   

2.
基于状态机的递归算法非递归化框架   总被引:1,自引:0,他引:1  
由递归程序转换到非递归程序可以避免栈内存溢出问题并可以提高算法效率。借助状态机编程的思想,提出一种递归到非递归转换的框架。将函数的调用和返回过程看作是状态的转换,并将递归过程模拟为"进入函数"、"进入递归点"、"从递归点返回"等状态。实验中,将几种具有代表性的递归算法转换为非递归算法,从转换后代码可以看出,提出的框架与"while-while"和"while-if"等常见框架相比,具有结构清晰、代码简洁和转换过程程序化强的优点。  相似文献   

3.
递归做为一种算法设计思想在求解实际问题和程序设计中广泛应用,采用递归设计的算法具有思路清晰、易于描述复杂问题等优点。文中对递归算法的理论依据、设计思想、应用、递归的内部执行过程做了较为全面的探讨,并以火车进站问题为例,重点分析了如何根据问题的递归表达函数扩充为递归算法。同时,对递归的非递归化作了较为深入的分析和探讨,并给出了实例源程序。理论分析和实践证明,在具体应用问题中,通过寻找问题对应的递归表达函数,可以容易和准确地设计出求解的递归算法,提高算法设计效率。  相似文献   

4.
虽然递归算法具有结构简练、清晰、可读性强等优点,但有时受执行效率和程序设计语言的限制,必须实现递归向非递归的转换.提出一个通用的算法框架实现一般递归算法向非递归算法的转换.该框架产生的非递归算法没有标号,适用于大多数程序设计语言.结合几个典型的实例说明该框架的应用方法和有效性.  相似文献   

5.
在数据结构基础上使用程序递归算法设计是目前进行软件开发应用最广泛的方法.使用递归算法进行程序编写可以减少很多操作细节,从而简化程序编写,而且递归算法结构简单且清晰,易读性比较强,最大的优势递归算法正确率高、验证比较方便.对递归程序算法的应用进行了分析,并探讨了递归算法的实现策略.  相似文献   

6.
二叉树遍历递归算法非递归化的讨论   总被引:3,自引:0,他引:3  
尽管递归算法具有结构简炼、清晰、可读性强等优点,但递归算法在执行过程会耗费太多的时间和空间,为了追求算法的时空效率,必须将递归算法转化为非递化算法,问题才能得到有效解决,本文讨论了在递归算法执行过程中栈的变化和给出了改进的非递归化算法。  相似文献   

7.
递归算法的非递归化实现   总被引:14,自引:0,他引:14  
由递归算法直接转换成相应的非递归算法能有效地提高程序的执行效率,本文列出了几类递归算法的非递归化实现方法,分别说明了这几类递归算法的特点及算法实例,并给出了相应的非递归算法。  相似文献   

8.
递归算法在理解上比较困难,是教学上的一个难点.如果教师能从怎样设计递归、递归思想的建立和递归程序执行过程等方面去引导,学生将会比较客易接受.通过介绍递归的定义和原理.用实际的例子来阐述如何实现递归.  相似文献   

9.
递归问题的非递归实现方法的应用研究   总被引:1,自引:0,他引:1  
使用非递归方式实现递归问题的算法程序,不仅可以节省存储空间,而且可以极大地提高算法程序的执行效率.本文将递归问题分成简单递归问题和复杂递归问题;简单递归问题的非递归实现采用递推技术加以求解,复杂递归问题则根据问题求解的特点采用两类非递归实现算法,使用栈加以实现.  相似文献   

10.
大量已存在的二叉树非递归遍历算法的缺陷是过程不清晰。通过分析二叉树遍历过程中每个结点的进出栈情况.用简单的图示说明了一种易理解的非递归遍历二又树的算法,实现了此算法,并说明了它的正确性,分析了它的时间及空间复杂度。三种遍历方式都可以通过此算法实现。  相似文献   

11.
An efficient swap algorithm for the lattice Boltzmann method   总被引:1,自引:0,他引:1  
During the last decade, the lattice-Boltzmann method (LBM) as a valuable tool in computational fluid dynamics has been increasingly acknowledged. The widespread application of LBM is partly due to the simplicity of its coding. The most well-known algorithms for the implementation of the standard lattice-Boltzmann equation (LBE) are the two-lattice and two-step algorithms. However, implementations of the two-lattice or the two-step algorithm suffer from high memory consumption or poor computational performance, respectively. Ultimately, the computing resources available decide which of the two disadvantages is more critical. Here we introduce a new algorithm, called the swap algorithm, for the implementation of LBE. Simulation results demonstrate that implementations based on the swap algorithm can achieve high computational performance and have very low memory consumption. Furthermore, we show how the performance of its implementations can be further improved by code optimization.  相似文献   

12.
The randomized incremental insertion algorithm of Delaunay triangulation in E3 is very popular due to its simplicity and stability. This paper describes a new parallel algorithm based on this approach. The goals of the proposed parallel solution are not only to make it efficient but also to make it simple. The algorithm is intended for computer architectures with several processors and shared memory. Several versions of the proposed method were tested on workstations with up to eight processors and on datasets of up to 200000 points with favorable results.  相似文献   

13.
N-step incremental straight-line algorithms   总被引:7,自引:0,他引:7  
This class of algorithms extends Bresenham's (1965) integer straight-line algorithm to generate more than one pixel per inner loop, thus reducing inner loop overhead. The quad-step algorithm is too large to justify its use in older hardware with limited memory space, but it can be viable in the context of modern memory and software sizes. Because the algorithm reduces both calculation overhead and the number of memory accesses for adjacent pixels, it can improve the performance of current systems that are limited in their processor speed and of future systems that might be limited in their memory speed. The algorithm gives results identical to those from Bresenham's single-step routine while drawing pixels in the expected direction from start to end point. Furthermore, as the gradual trend towards more bits per pixel continues, a processor supporting multi-word burst data instructions could make good use of this algorithm in speeding up line drawing into a 24-bits-per-pixel, 1-pixel-per-word color frame buffer. I chose to implement 4 steps per loop because it gave a useful performance improvement without exceeding the resources of the target processor, and it was small enough to hand-code. However, the techniques described can be used to construct a straight-line algorithm that generates more than 4 steps per loop. The relatively small average decision tree sizes indicate that algorithms of greater than 4 pixels per step might further improve line-drawing efficiency  相似文献   

14.
Operating systems code is often developed according to principles like simplicity, low overhead, and low memory footprint. Schedulers are no exceptions. A scheduler is usually developed with flexibility in mind, and this restricts the ability to provide real-time guarantees. Moreover, even when schedulers can provide real-time guarantees, it is unlikely that these guarantees are properly quantified using theoretical analysis that carries on to the implementation. To be able to analyze the guarantees offered by operating systems’ schedulers, we developed a publicly available tool that analyzes timing properties extracted from the execution of a set of threads and computes the lower and upper bounds to the supply function offered by the execution platform, together with information about migrations and statistics on execution times. rt-muse evaluates the impact of many application and platform characteristics including the scheduling algorithm, the amount of available resources, the usage of shared resources, and the memory access overhead. Using rt-muse, we show the impact of Linux scheduling classes, shared data and application parallelism, on the delivered computing capacity. The tool provides useful insights on the runtime behavior of the applications and scheduler. In the reported experiments, rt-muse detected some issues arising with the real-time Linux scheduler: despite having available cores, Linux does not migrate SCHED_RR threads which are enqueued behind SCHED_FIFO threads with the same priority.  相似文献   

15.
A novel dual-microphone speech enhancement technique is proposed in the present paper. The technique utilizes the coherence between the target and noise signals as a criterion for noise reduction and can be generally applied to arrays with closely-spaced microphones, where noise captured by the sensors is highly correlated. The proposed algorithm is simple to implement and requires no estimation of noise statistics. In addition, it offers the capability of coping with multiple interfering sources that might be located at different azimuths. The proposed algorithm was evaluated with normal hearing listeners using intelligibility listening tests and compared against a well-established beamforming algorithm. Results indicated large gains in speech intelligibility relative to the baseline (front microphone) algorithm in both single and multiple-noise source scenarios. The proposed algorithm was found to yield substantially higher intelligibility than that obtained by the beamforming algorithm, particularly when multiple noise sources or competing talker(s) were present. Objective quality evaluation of the proposed algorithm also indicated significant quality improvement over that obtained by the beamforming algorithm. The intelligibility and quality benefits observed with the proposed coherence-based algorithm make it a viable candidate for hearing aid and cochlear implant devices.  相似文献   

16.
嵌入式实时操作系统中基于页的内存保护   总被引:2,自引:0,他引:2  
刘云生  胡昊明 《计算机工程》2005,31(18):53-55,92
以自主开发的嵌入式实时操作系统ARTs-OS为原型,提出并实现了一种基于页机制的内存保护方法,该方法简单,具有较高的执行效率,且易于实现与跨平台移植.  相似文献   

17.
提出了一种采用自适应差分脉冲编码技术的语音压缩编码算法,压缩比为8:3,因其算法非常简单,可用单片机(如51系列)实现.此算法可用于低成本的单片机语音存储系统或语音传输系统.最后还给出了此算法在远距离语音信号传输中的应用实例,在此实例中采用的是C8051 F330单片机,在RS-422传输信道上实现了全双工远距离语音信号传输.  相似文献   

18.
A speech pre-processing algorithm is presented that improves the speech intelligibility in noise for the near-end listener. The algorithm improves intelligibility by optimally redistributing the speech energy over time and frequency according to a perceptual distortion measure, which is based on a spectro-temporal auditory model. Since this auditory model takes into account short-time information, transients will receive more amplification than stationary vowels, which has been shown to be beneficial for intelligibility of speech in noise. The proposed method is compared to unprocessed speech and two reference methods using an intelligibility listening test. Results show that the proposed method leads to significant intelligibility gains while still preserving quality. Although one of the methods used as a reference obtained higher intelligibility gains, this happened at the cost of decreased quality. Matlab code is provided.  相似文献   

19.
L. Kobbelt 《Computing》1994,52(4):355-369
We present a new algorithm which computes dot-products of arbitrary length with minimal rounding errors, independent of the number of addends. The algorithm has anO(n) time andO(1) memory complexity and does not need extensions of the arithmetic kernel, i.e, usual floating-point operations. A slight modification yields an algorithm which computes the dot-product in machine precision. Due to its simplicity, the algorithm can easily be implemented in hardware.  相似文献   

20.
The lazy sweep ray casting algorithm for rendering irregular grids   总被引:1,自引:0,他引:1  
Lazy sweep ray casting is a fast algorithm for rendering general irregular grids. It is based on the sweep-plane paradigm, and it is able to accelerate ray casting for rendering irregular grids, including disconnected and nonconvex unstructured irregular grids (even with holes) with a rendering cost that decreases as the “disconnectedness” decreases. The algorithm is carefully tailored to exploit spatial coherence even if the image resolution differs substantially from the object space resolution. Lazy sweep ray casting has several desirable properties, including its generality, (depth-sorting) accuracy, low memory consumption, speed, simplicity of implementation and portability (e.g. no hardware dependencies). We establish the practicality of our method through experimental results based on our implementation, which is shown to be substantially faster (by up to two orders of magnitude) than other algorithms implemented in software. We also provide theoretical results, both lower and upper bounds, on the complexity of ray casting of irregular grids  相似文献   

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

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