Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

11
votes
7answers
485 views

Are functional languages better at recursion?

TL;DR : Do functional languages handle recursion better than non-functional ones? I am currently reading Code Complete 2. At some point in the book, the author warns us about recursion. He says it ...
14
votes
3answers
415 views

What's the difference between recursion and corecursion?

What's the difference between definitions? recursion corecursion In wiki, there is few information without clear code for good understanding these terms. But, could you give very simple examples, ...
3
votes
2answers
194 views

Writing recursive functions

I am having a lot of trouble writing recursive functions related to trees. I can't just use google for these functions as they are not general and I won't be able to use google in an exam setting! Is ...
18
votes
9answers
904 views

What are some games involving recursion?

I need to introduce a group of 5-15 people to recursion and I would like to do so by using a physical game/dance/activity they can play to get a feeling for recursion. The class is not so much focused ...
1
vote
3answers
118 views

Pseudocode for an echo using recursion

Using pseudocode, what would the code for an echo using recursion be? UPDATE: Appears I should have been more clear. By echo I mean the pattern sound exhibits when it echos, not echo as in repeatly ...
5
votes
1answer
155 views

Process arbitrarily large lists without explicit recursion or abstract list functions?

This is one of the bonus questions in my assignment. The specific questions is to see the input list as a set and output all subsets of it in a list. We can only use cons, first, rest, empty?, empty, ...
4
votes
3answers
173 views

Local Stack vs Call Stack

On the matter of Recursion: When you create a recursive function, you create a call stack. Ok, no problem; However, a comment on this page (look for comments by "LKM") triggered my curiosity (and ...
5
votes
3answers
292 views

How can I best study a problem to determine whether recursion can/should be used?

In some cases, I fail to see that a problem could be solved by the divide and conquer method. To give a specific example, when studying the find max sub-array problem, my first approach is to brute ...
12
votes
7answers
695 views

Why don't more languages support recursive/nested comments? [closed]

Possible Duplicate: Why do most programming languages not nest block comments? Most languages I've worked with don't have support for recursive/nested comments. Is there any reason why ...
2
votes
2answers
249 views

How do you work with Asynchronous functions, recursively?

I am currently working on FLEX and have to call a web services. once I have the result, I have to call the web service again, with the previous result as the input. A compounding problem, is that ...
4
votes
2answers
238 views

Is this the right strategy to convert an in-level order binary tree to a doubly linked list?

So I recently came across this question - Make a function that converts a in-level-order binary tree into a doubly linked list. Apparently, it's a common interview question. This is the strategy I ...
41
votes
18answers
3k views

Recursion without factorial, Fibonacci numbers etc

Almost every article about recursion includes examples with factorial or Fibonacci numbers which are a) math b) useless in real life. Are there some interesting non-math code examples to teach ...
3
votes
3answers
331 views

Storing hierarchical template into a database

If this title is ambiguous, feel free to change it, I don't know how to put this in a one-liner. Example: Let's assume you have a html template which contains some custom tags, like <text_field ...
10
votes
6answers
659 views

Recursion — is it “divide and conquer” or “code reuse”

Recursion -- as we all know -- is one of those problems -- that wrapping your head around feels like achieving a "milestone" in your programming voyage. But when it comes to actually using it in ...
14
votes
9answers
1k views

How do I explain “Recursion” to a 8 years old kid? [closed]

Possible Duplicate: In plain English, what is recursion? What is the best way to explain "Recursion" to 8 years old kid? I tried with the Fibonacci Series but i failed.
2
votes
4answers
351 views

Advantage or disadvantages between recursive functions and for cycles

Whats the difference between the two procedures? When should I be using a recursive function instead of a normal for-loop?
13
votes
6answers
682 views

How do I determine the runtime of a double recursive function?

Given any arbitrarily double-recursive function, how would one calculate its run time? For Example (in pseudocode): int a(int x){ if (x < = 0) return 1010; else return b(x-1) + ...
9
votes
2answers
529 views

Understanding Backtracking in C++

I have a good basic understanding of the fundamentals of C++, I also have an understanding of how recursion works too. I came across certain problems like the classic eight queens problem and solving ...
11
votes
3answers
282 views

Why does the iterative version take longer?

I was looking over at http://programming.lispdream.com/blog/2011/06/recursion-vs-iteration/ and I saw that on his implementation of the recursive and iterative implementations of the factorial ...
2
votes
6answers
288 views

How do i speedily traverse a file system while extracting/extrapolating various data and provide user feedback?

I'm working on a system file scanner that reveals info about various files (e.g. size, last used, duplicates, etc). Currently I'm traversing the file system once just to get a good measure of the ...
14
votes
10answers
2k views

What is so difficult about pointers/recursion?

In the perils of java schools Joel discusses his experience at Penn and the difficulty of "segmentation faults". He says [segfaults are difficult until you] "take a deep breath and really try ...
3
votes
6answers
378 views

Daily recursion

As a student, I'm looking for hard stuff to do for become a good programmer. I've tried Personal Software Process (and I hate it), and now I'm improving myself with some agile kata on OOP in c++ and ...
5
votes
10answers
899 views

In term of performance : while , for … Loops VS recursion

What is better for performance to write the loop as linear e.g. for , while or write it as recursion ?
6
votes
6answers
279 views

Resources for improving your comprehension of recursion?

I know what recursion is (when a patten reoccurs within itself, typically a function that calls itself on one of its lines, after a breakout conditional... right?), and I can understand recursive ...
31
votes
17answers
3k views

In plain English, what is recursion?

The idea of recursion is not very common in real world. So, it seems a bit confusing to the novice programmers. Though, I guess, they become used to the concept gradually. So, what can be a nice ...
5
votes
7answers
782 views

Is recursion an instance of being “too clever” when programming?

I've read several books and learned through experience that optimizing code to the point where it is inscrutable, or coming up with an extremely fast but extremely complex solution to a problem is not ...
5
votes
6answers
587 views

Can all the recursive functions be coded with iterations?

What are the advantages of recursion? Some programming languages can optimize tail recursion, but, still in general terms, recursion consume more resources than regular loops. Is it possible to ...
14
votes
6answers
1k views

What imperative programming languages do not support recursion?

To my knowledge, all modern imperative programming languages support recursion in the sense that a procedure can call itself. This was not always the case, but I cannot find any hard facts with a ...