3
$\begingroup$

How to explain recursion and iteration to someone without using formulas or single line of code? Difference betwen them, why to use one over another?

(a.k.a : How to explain recursion and iteration to my grandmother)

(a.k.a : How to explain difference between recursion and iteration to my grandmother)

Every one had some kind Tower of Hanoi problem and there they figure out recursion solution and iterative solution. But if you have college (e.g. PM) that dont have idea neither about programing or mathematics how to explain it ?

$\endgroup$
  • 1
    $\begingroup$ I learned recursion when I was pretty young. I wrote games in BASIC using "goto" statements, then someone told me that was bad so I changed them all to "gosub". It blew the stack and I learned what recursion is. $\endgroup$ – DanielV Dec 29 '14 at 14:42
  • $\begingroup$ @Amzoti where is child story? $\endgroup$ – malakrsnaslava Dec 29 '14 at 14:45
  • $\begingroup$ thanks. stackoverflow.com/questions/3021/… This is nice answer. $\endgroup$ – malakrsnaslava Dec 29 '14 at 14:51
  • 1
    $\begingroup$ Come on, man. I can not explain where are "messages" in the phone to my granny. You have no chance. $\endgroup$ – Jihad Dec 29 '14 at 15:08
  • 2
    $\begingroup$ I think this question would be a good place to look. $\endgroup$ – KSmarts Dec 29 '14 at 15:31
5
$\begingroup$

Today is not the first april, but...

To explain recursion you need to explain recursion.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ google.com/… Google alredy had it :) $\endgroup$ – malakrsnaslava Dec 29 '14 at 15:14
  • $\begingroup$ @malakrsnaslava lol, even Google is joking about recursion. $\endgroup$ – Jihad Dec 29 '14 at 15:15
0
$\begingroup$

Just use the every day words :)

Iteration You have 15 potatoes to peel :

For each potato, peel that potato.

recursion You need to turn a chocolate plate into chocolate chips:

Split the chocolate pieces in half (and proceed again with the pieces you obtained until each piece is small enough).

| cite | improve this answer | |
$\endgroup$
0
$\begingroup$

Recursion is a method to solve a problem in terms of a smaller problem of the same nature.

To find a word in a dictionary, you open it somewhere, check on which side the word can be and perform a search for the word in that side only. So to find you can... find.

Iteration can be seen as a particular form of recursion where one of the subproblems has unit size. Like flipping the pages one at a time instead of by blocks.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.