# State some examples of recursive functions?

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

#### chinmay.sahoo

• 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

• 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
5391 Views
05-14-2016, 02:20:24
by TomClarke
1 Replies
2560 Views
04-27-2016, 04:51:59
by TomClarke
0 Replies
2220 Views
02-25-2016, 03:59:05
by chinmay.sahoo
20 Replies
28179 Views
03-22-2021, 07:03:18
by kareem
0 Replies
1393 Views
03-20-2019, 19:21:40
by SEOTechniques