4

From what I understand, in simple terms,

  • The definition of iteration : The act of repeating a process

  • The definition of recursion : The act of repeating smaller process of the same problem

It these definitions aren't too far fetched, it looks to me that a recursion is a type of iteration. But I am yet to find a reliable source to confirm it.

So my question is, is recursion is a type of iteration or I am comparing apple and orange?

The premise : In the process of learning computer programming, a book is introducing me to recursion. I understand the basics and I know how it works from a programmers perspective. But I don't understand why they aren't introducing recursion as a type of iteration. They are introducing iteration and recursion as two different concepts. Why so?

(I've scoured through math.stackexchange and stackoverflow, but yet to find a clear explanation to my question.)

  • 3
    Perhaps you could elaborate on what it is you are trying to accomplish? It sounds like you are having trouble with semantics instead of any underlying mathematics associated with these words. – Ethan Splaver Jan 24 '15 at 15:16
  • 2
    From a mathematical point of view, you'd have to define the terms more tightly and rigorously to be sure that iteration was a form of recursion. – Thomas Andrews Jan 24 '15 at 15:23
  • Here is a stackoverflow post about recursion vs itteration that might be useful. – Winther Jan 24 '15 at 15:35
  • You might be interested in reading http://en.wikipedia.org/wiki/Primitive_recursive_function#Computer_language_definition, which might be a reasonable representative of "iteration". Then compare it to http://en.wikipedia.org/wiki/Ackermann_function, which has a simple recursive definition. In some sense recursion is more powerful than iteration, but as Thomas Andrews points out, it really depends on how you define each term. – Erick Wong Jan 24 '15 at 15:47
  • @Ethan Edited my question. – Quazi Irfan Jan 24 '15 at 15:48
  • @ThomasAndrews Since I don't know the rigorous mathematical definitions, maybe that's why I am having this question. So from pure math perspective, what's the difference between these two? – Quazi Irfan Jan 24 '15 at 15:54
  • I'm afraid there isn't actually a rigorous definition of the terms, except in a very specialized sense that strongly depends on a particular model. But I could be wrong. – Thomas Andrews Jan 24 '15 at 15:56
  • @Winther The SE link explains their interchangeability, but it doesn't answer my question. "so in that sense they are the same "...So if I tell, recursion is a type or iteration, Am I wrong? – Quazi Irfan Jan 24 '15 at 15:58

1 Answers1

1

Iteration is an artifact of programming and inherently constructive in nature.

Recursion is fundamental and not necessarily constructive.

So it is apples and oranges.

pedant
  • 106