Hello guys, if you are trying to learn recursion but struggling and looking for some common recursive coding problems then you have come to the right place.
These are common coding problems that can be solved using recursion, these will not only help in learning recursion but also in your coding interview preparation. I personally found the best way to learn Recursion in Java or any programming language is by doing some examples.
Every programmer knows What is a recursive function or Recursion in Java but when it comes to applying Recursion to a problem, many fumbles. As per my experience, Recursion is a tricky programming concept, some people get it very quickly, but for some programmers, it takes ages to understand Recursion and develop the ability to apply it.
In this Java tutorial, we will see some Recursion based example programs written in the Java programming language. You can also use this as a Java programming exercise.
List of Questions:
1. Write a program to calculate factorial using recursion in Java?
2. Write a program to Print Fibonacci Series in Java using Recursion?
3. Write a program to reverse String in Java using Recursion?
4. Write a countDown(int number) method in Java using Recursion which prints countdown till zero to console, like count(3) should print 3 2 1 0
5.Program to reverse a number using Recursion in Java?
6. Write a Java program to print digitsToWords(int number) for example digitToWords(321) should print three two ones?
7. Write a Java program to calculate the power of a number like power(int number, int power) like power(2, 3) should return 8?
8. Write a program to calculate the sum of arithmetic series from 1 to N?
9. Write a program to calculate Greatest Common Division GCD using Euclid's algorithm
10. Write a Java program to convert Decimal to binary using recursion?
16. How to calculate the sum of digits using recursion in Java?
17. How to find all permutations of a given String in Java?
18. How to implement a binary search algorithm using recursion?
19. How to implement bubble sort algorithms using recursion?