是否存在“必须”的问题使用递归 [英] is there problem that "has to" use recursion

查看:84
本文介绍了是否存在“必须”的问题使用递归的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




请提出有的问题使用递归(递归调用

本身。)

最好是现实世界的例子,而不是骑士之旅。


我''我正在考虑不再使用堆栈...


谢谢。

解决方案

[F''ups设置为comp.programming]


p ... @ mmail.ath.cx写道:


请给出问题那个有使用递归(递归
调用自身。)




这不是C语言问题,因此,它是偏离主题的

in clc。


C语言确实为那些想要使用

的人提供递归。然而,由于C语言标准

在任何深度上都没有提供最低限度的实现要求,因此它受到实际和务实的警告,因为它们在clc中也很大程度上不在主题之内。 />
效率的递归。


-

彼得


< blockquote> pa***@mmail.ath.cx 写道:


请提出有的问题。使用递归(递归
调用自己。)最好是现实世界的例子,而不是骑士之旅。

我正在考虑消除堆栈的使用......




不能。已知有消除递归的标准方法,

可能涉及使用辅助堆栈。由于这可以总是做到
,所以没有任何问题实际上依赖于递归。


-

"如果你想要通过groups.google.com发布跟进,不要使用

破损的回复链接在文章的底部。点击

" show options"在文章的顶部,然后点击

回复在文章标题的底部。 - Keith Thompson


pa***@mmail.ath。 cx 写道:

请提出HAS TO的问题。使用递归(递归调用
本身。)最好是现实世界的例子,而不是骑士之旅。

我正考虑消除堆栈的使用......




没有,如果你只想考虑取消使用电话

stack;你总是可以将算法变成迭代算法,可能需要使用你自己的堆栈ADT。很多,如果你的意思是

完全消除任何堆栈;例如,quicksort在数组的两半使用
的递归,而AFAIK只有下半部分可以在不使用手写堆栈的情况下消除
。 br />

Richard


Hi

Please give problems that "HAS TO" to use recursion (recursive calls to
itself.)
Preferrably real world examples, not knights tour.

I''m thinking about eliminating the use of stack...

Thanks.

解决方案

[F''ups set to comp.programming]

p...@mmail.ath.cx wrote:


Please give problems that "HAS TO" to use recursion (recursive
calls to itself.)



This is not a C language question and, as such, it is off-topic
in clc.

The C language does provide recursion, for those who want to use
it. However, it is subject to practical and pragmatic caveats that
are also largely off topic in clc since the C language standards
provide no minimal implementation requirements on either depth or
efficieny of recursion.

--
Peter


pa***@mmail.ath.cx wrote:


Please give problems that "HAS TO" to use recursion (recursive
calls to itself.) Preferrably real world examples, not knights tour.

I''m thinking about eliminating the use of stack...



Can''t. There are known standard means of eliminating recursion,
which may involve the use of an auxiliary stack. Since this can
always be done, no problem actually relies on recursion.

--
"If you want to post a followup via groups.google.com, don''t use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson


pa***@mmail.ath.cx wrote:

Please give problems that "HAS TO" to use recursion (recursive calls to
itself.) Preferrably real world examples, not knights tour.

I''m thinking about eliminating the use of stack...



None, if you''re merely thinking about eliminating the use of the call
stack; you can always flatten the algorithm into an iterative one,
possibly with the use of your own stack ADT. Many, if you mean
eliminating any stack at all; quicksort, for example, uses recursion on
both halves of the array, and AFAIK only the second half can be
eliminated without the use of a hand-written stack.

Richard


这篇关于是否存在“必须”的问题使用递归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆