The recursion tag has no wiki summary.
0
votes
1answer
216 views
Having trouble understanding recursion [duplicate]
I have just started learning about recursion but I'm having a hard time understanding it. Please would you recommend any links or books that explain recursion in detail.
10
votes
2answers
340 views
Can and do compilers convert recursive logic to equivalent non-recursive logic?
I've been learning F# and it's starting to influence how I think when I'm programming C#. To that end, I have been using recursion when I feel the result improves readability and I can't envision it ...
4
votes
2answers
299 views
Reason for return statement in recursive function call
I just had a doubt in my mind. The following subroutine(to search an element, in a list, for example) has a return statement at the end:
list *search_list(list *l, item_type x) {
if (l == NULL) ...
1
vote
1answer
347 views
Decrement operator difference between C++ and Java? [closed]
Please tell me why the same piece of code behaves differently in C++ and JAVA.
Ok first I implement a function to calculate the factorial of an Int RECURSIVELY
In JAVA:
int f(int x)
{
...
16
votes
6answers
2k views
What methods are there to avoid a stack overflow in a recursive algorithm?
Question
What are the possible ways to solve a stack overflow caused by an recursive algorithm?
Example
I'm trying to solve Project Euler problem 14 and decided to try it with a recursive ...
1
vote
1answer
116 views
Course Map Generator
My university lists the rotation of courses each semester/year. Therefore, it is possible to predict when every class will be taught.
I am trying to create a JavaScript (language is irrelevant, ...
1
vote
3answers
187 views
Designing a self-describing JSON document system
I'm trying to devise a document system for a specific domain involving simple objects (People, Companies, Invoices, etc.) that would also be able to completely describe itself. This self-description ...
15
votes
3answers
822 views
How many are too many nested function calls?
Quoted from MSDN about StackOverflowException:
The exception that is thrown when the execution stack overflows because it contains too many nested method calls.
Too many is pretty vague here. ...
2
votes
1answer
737 views
What does “recursive” mean for a program which processes files and directories?
I know what recursion is in programming. I do understand the basics of version control systems (have used svn that is). But I have often wondered what the meaning of "recursion" or "recursive" is ...
6
votes
1answer
381 views
Is this an example of recursion?
I am implementing inheritance of something called Contexts. Each Context holds a link to its parent context. If that Context is the root Context, its parent is null.
In order to walk up the ...
71
votes
8answers
9k views
Recursion or while loops
I was reading about some development interview practices, specifically about the technical questions and tests asked at interviews and I've stumbled quite a few times over sayings of the genre "Ok you ...
5
votes
5answers
604 views
What is the difference between “recursion” and “self-reference”?
The wikipedia articles are too advanced for me to understand, could someone give me a simple explanation please?
20
votes
2answers
1k views
Y combinator and tail call optimizations
The definition of a Y combinator in F# is
let rec y f x = f (y f) x
f expects to have as a first argument some continuation for the recursive subproblems.
Using the y f as a continuation, we see ...
4
votes
4answers
404 views
Is there a way to display the stack during recursion method?
I'm trying to learn recursion. I copied this bit of code from my book and added the displays to help me trace what the method is doing and when.
public static void main(String[] args) {
...
11
votes
3answers
1k views
Performance: recursion vs. iteration in Javascript
I have read recently some articles (e.g. http://dailyjs.com/2012/09/14/functional-programming/) about the functional aspects of Javascript and the relationship between Scheme and Javascript (the ...