Talk:Recursion (computer science)

message: I think it would be cool to have a paragraph to recognize the fathers of the science of recursion.  von Neumann is a likely lead, but haven't found any primary sources just yet.  — Preceding unsigned comment added by 165.234.0.138 (talk) 14:18, 10 April 2012 (UTC)
thread_title:  History 

message: Base case redirects here. Would it not be helpful therefore to have a clear definition of the term, 'base case'?  —Preceding unsigned comment added by 82.138.219.211 (talk) 23:50, 13 February 2010 (UTC)
thread_title:  Base Case 

message: Wouldn't it be a good idea to include some information about Recursive procedures and processes? (as in ) --Kamitsaha (talk) 12:03, 7 February 2009 (UTC)
thread_title:  Recursive Procedures and Processes 

message: It would be nice to have a simple code example for generative recursion.
--84.9.82.184 16:31, 26 April 2007 (UTC)
thread_title:  Generative (synthetic) recursion 

message: Is it possible to give general statements about the complexity (Big O notation) of recursive functions? --Abdull (talk) 12:29, 11 August 2008 (UTC)
thread_title:  Complexity of recursive functions 

message: The example programs should check for n==0 rather than n==1. Currently they simply crash when input is 0. (They shouldn't because fact(0) is defined 1 in the fact function definition.) --80.66.6.99 (talk) 13:05, 22 August 2008 (UTC)
replies: text: Done. --Quuxplusone (talk) 08:00, 24 August 2008 (UTC)

text: Wouldn't checking if n <= 1 be better? I agree that n == 1 is incorrect, but n == 0 adds a needless cycle for input > 0 (e.g., for 3! it computes 3x2x1x1 instead of 3x2x1). 142.20.20.193 (talk) 16:19, 7 April 2015 (UTC)
thread_title:  Factorial Implementations for n=0 

message: In this article, it gives an example of recursion as follows:
"To make a very literal example out of this: If an unknown word is seen in a book, the reader can make a note of the current page number and put the note on a stack (which is empty so far). The reader can then look the new word up and, while reading on the subject, may find yet another unknown word. The page number of this word is also written down and put on top of the stack. At some point an article is read that does not require any explanation. The reader then returns to the previous page number and continues reading from there. This is repeated, sequentially removing the topmost note from the stack. Finally, the reader returns to the original book. This is a recursive approach."
However, this seems more like a standard series of function calls...it doesn't seem to be "calling itself" in any way.
68.40.187.164 (talk) 04:38, 17 February 2009 (UTC)
thread_title:  Possible error? 

message: All examples in this tutorial can be rewriten using simple while loop. All presented exaples are recursions of same category. None of current examples show true strength of recursion.
Number of examples whit recursion of same type can be reduced. Complex examples should be added, for instance:
Simple brute force (for instance Catalan's_problem solving)
Searching filename in directories tree
..  —Preceding unsigned comment added by Rahulov (talk • contribs) 23:15, 17 May 2009 (UTC)
thread_title:  More complex examples 

message: The article wrongly claims that neither C nor Java optimize tail recursion.
I just ran this test on my default OSX-installed JVM, and it shows that the code was transformed into its non-recursive equivalent: http://www.ibm.com/developerworks/java/library/j-diag8.html. Similarly, there's plenty examples online that show that GCC can not only optimize tail-recursive calls, but also quasi-tail-recursive calls, as in the naive definition of fibonacci. 130.92.9.56 (talk) 12:22, 29 July 2010 (UTC)
replies: text: I think the issue is you are identifying "tail recursion" with compiler optimization. In the Scheme language, for example, all conforming implementations must optimize tail recursion so that it does not consume stack space. This is part of the language and programmers can rely on it. In C and Java, some compilers may do the optimization, but it is not part of the language specification, and programmers cannot rely on it. Moreover, in Java, it is generally considered impossible for an implementation to support the security model and also optimize tail calls. This issue with Java has been discussed to death all over the web; there seem to be rumors that Java 7 might have some support. — Carl (CBM · talk) 14:54, 29 July 2010 (UTC)
thread_title:  Java, C and tail recursion 

message: Recursion is a major cause of problems in software applications.
The article needs to emphasize that a termination condition is essential or the algorithm is not recursion - it is an infinite loop and a run-time failure.
Diagnosis and debugging techniques for recursion problems (such as stack overflow) would also be good to add.  —Preceding unsigned comment added by Brutzman (talk • contribs) 17:50, 30 August 2010 (UTC)
thread_title:  Not enough about termination and recursion problems 

message: Quote: "If your problem requires evaluating properties and then processing depending on those properties, recursive solutions will most likely involve cumbersome conditional statements whereas an iterative solution would intuitively process each case."
Run that by me again ...
- Does the phrase "evaluating properties and then processing depending on those properties" say anything more than the simple term conditional processing or conditional execution?
- What is "cumbersome" about a conditional statement?
- How exactly would an iterative solution "intuitively" perform conditional processing without any conditional statements?
John lindgren (talk) 18:22, 17 June 2011 (UTC)
thread_title:  Recursion vs. iteration 

message: "Recursion" is a mathematical method, not "computer science".  That nowadays numerical mathematical computations are made with computers is another matter. There is absolutely no connection between the availability of "recursive procedures" in a computer language and the use of a recursive algorithm, a "do loop" does it just as well(more efficiently)!
Most of this material should be "Recursion(mathematics)"
Then there will be left some other material for "Recursion(computer science)" like "recursive procedures" with the procedure(subroutine) calling itself and other similar matter
Stamcose (talk) 09:57, 7 January 2013 (UTC)
thread_title:  The concept is messy! 

message: Most of the section is written in a highly un-encyclopedic tone (talk of "gray matter computers" and "soft tissue," abbreviation of "Fibonacci," what appears to be an attempted pun in the phrase "or even to re-curse @#$%^& at all,") and a gigantic list of the same algorithm in tons of different programming languages. It looks like it needs a serious rewrite, but I don't feel familiar enough with the topic to do so myself. 72.82.63.137 (talk) 23:22, 24 February 2013 (UTC)
replies: text: I agree completely.  This section was a discursive, unencyclopedic essay with no reliable sources.  I have removed it, following WP policies about essays and original research.  Also, the numerous code examples were not helpful.  The following section on the Euclidean algorithm for GCD is not much better, but at least it is a little more compact.  Also, both Fibonacci and GCD have the inconvenient property (for the purposes of this article) that they are more easily and more efficiently calculated iteratively.... --Macrakis (talk) 00:13, 25 February 2013 (UTC)
thread_title:  Section 'Fibonacci' is a total mess 

message: Does anyone know of a comprehensive hierarchy of recursion techniques?  I found the following hierarchy pdf that covers just list processing:
 Recursive list processing technique
     element technique
     list technique
         naive technique
         accumulator technique
         railway-shunt technique
         inverse naive technique
     position technique
     combination technique
I think making the different types of recursion explicit would improve the article. pgr94 (talk) 13:48, 21 March 2014 (UTC)
thread_title:  Hierarchy of recursion types 

message: The current examples are weak. Almost all of them are as just as naturally (or more so!) expressed iteratively (factorial, gcd, binary search, list traversal). The Towers of Hanoi example, rather than presenting the algorithm for moving the disks, just presents the calculation of the count of moves, with no explanation or motivation. There are no examples of mutual (or multiple) recursion; a simple example would be a symbolic differentiation program for expressions involving + and *. --Macrakis (talk) 10:53, 9 February 2015 (UTC)
thread_title: Examples

message: I added Introduction to Recursive Programming to the list of monographs on recursive programming.  My edit was undone because the book was previously removed due to self promotion by the author.  This latest publication on the topic is a valuable resource that should be included. Bkthfrst (talk) 03:54, 3 October 2017 (UTC)
replies: text: Can you give a reason for your claim? Why is the resource valuable? - Jochen Burghardt (talk) 05:01, 3 October 2017 (UTC)
replies: text: It is a comprehensive introduction to recursive programming.  Unlike the other books in the list, its code examples are presented in Python, which is an increasingly popular language for computer science education, as well as scientific and commercial applications.  The code examples are available for free, without purchase of the book. Bkthfrst (talk) 21:19, 3 October 2017 (UTC)
thread_title:  Books about recursive programming 

message: The redirect Recursion(computer science) has been listed at redirects for discussion to determine whether its use and function meets the redirect guidelines. Readers of this page are welcome to comment on this redirect at  until a consensus is reached.  Steel1943 (talk) 21:25, 2 June 2023 (UTC)
thread_title:  "[[:Recursion(computer science)]]" listed at [[Wikipedia:Redirects for discussion|Redirects for discussion]] 

message: This article focuses on recursion in computer programming, and does not cover other uses of recursion in computer science, for example in databases and knowledge representation. It focuses on recursive functions and ignores recursive relations. See, for example, the recursive definition of the ancestor relation in the Datalog article.
Moreover,  because of its focus on programming, the article limits problem solving and execution methods to backward chaining, and it ignores forward chaining. 
More importantly, it does not distinguish between recursive structure and the way in which that structure is used to solve problems. It fails to point out that pure recursion can be understood declaratively, without understanding execution at all. Consider, for example, the Prolog program, which expresses that alice likes logic, and that she likes anything that likes logic:
likes(alice, logic).
likes(alice, X) :- likes(X, logic).
 Robert Kowalski (talk) 12:31, 6 March 2024 (UTC)
thread_title:  This article presents a narrow view of recursion in computer science