# State some examples of recursive functions?

### Author Topic: State some examples of recursive functions?  (Read 1367 times)

#### chinmay.sahoo

• Trade Count: (0)
• Full Member
• Thank You 2
• Posts: 158
• Karma: 0
##### State some examples of recursive functions?
« on: 04-04-2016, 04:22:57 »
Examples of recursive functions are as follows:-
Factorial of a given number
Palindrome
Fibonnaci series
GCD

#### friendhrm

• Trade Count: (0)
• Semi-Newbie
• Thank You 1
• Posts: 47
• Karma: 0
##### Re: State some examples of recursive functions?
« Reply #1 on: 12-20-2017, 00:43:07 »
The rule of thumb for recursion is, "Use recursion, if and only if on each iteration your task splits into two or more similar tasks".

So Fibonacci is not a good example of recursion application, while Hanoi is a good one.

So most of the good examples of recursion are tree traversal in different disquises.

For example: graph traversal - the requirement that visited node will never be visited again effectively makes graph a tree (a tree is a connected graph without simple cycles)

divide and conquer algorithms (quick sort, merge sort) - parts after "divide" constitute children nodes, "conquer" constitues edges from parent node to child nodes.

### Related Topics

Subject / Started by Replies Last post
1 Replies
2808 Views
05-14-2016, 02:20:24
by TomClarke
1 Replies
1964 Views
04-27-2016, 04:51:59
by TomClarke
0 Replies
1221 Views
02-25-2016, 03:59:05
by chinmay.sahoo
0 Replies
827 Views
12-28-2016, 00:47:12
by chinmay.sahoo
3 Replies
6769 Views
02-01-2018, 07:15:54
by RH-Calvin