# Iteration vs Recursion

In programming, iteration, and recursion are methods to solve problems. Now, I cover these two methods, gave a simple explanation then solve some common problems in a programming interview as examples.

## Iteration

Iteration is a repetition of a process based on loop. Technically, using `for`

or `while`

.

## Recursion

Recursion is a method that calls itself for a repetition.

## Examples

I wrote all examples in C. All problems are solved both in the iterative and recursive method.

### Factorial

Factorial (symbol: !) is multiplying all whole numbers from the chosen number down to 1.

### Fibonacci

Fibonacci (symbol: *F _{n}*) is an integer sequence that each number is the sum of the two proceeding ones.

### Reverse String

Reverse String is a common question in a programming interview. Example, "abc123" to be "321cba".

## Conclusion

Exactly, there are still some examples that I want to bring them here. I only want to make it faster. So, three examples are enough to make an understanding of iteration and recursion.

I still remember when I was with my friends, we tested the performance of the method of iteration and recursion. The recursion is slow, even if it makes the code smaller.

Focus on performance when making a solution. That is why I prefer an iteration method.