algorithm - Practical examples of Mutual Recursion? -


i reading mutual recursion.in materials,examples of problem determine whether integer or odd?

int is_even(unsigned int n) { if (n==0) return 1; else return(is_odd(n-1)); }  int is_odd(unsigned int n) { return (!iseven(n)); } 

obviously above problem can solved in easier manner using modulus operator.

other example problem find out if person female or male.this can solved in easier manner without using recursion.

so mutual recursion theoretical or there anywhere can use practically make solution simpler using other technique?

could please me out giving such example?

mutual recursion not common it's useful sometimes. parsing text "recursive descent" method 1 practical setting can find it.

http://en.m.wikipedia.org/wiki/recursive_descent_parser


Comments