Assignment-1: Recursion
1. Count the Number of Digits in a Number
• Write a recursive function that takes an integer as input and returns the total number of
digits.
Example: Input: 12345 -> Output: 5
2. Find the Maximum Element in an Array using Recursion
• Write a recursive function to find and return the maximum element from a given array.
Example: Input: [2, 5, 1, 8, 3] -> Output: 8
3. Check if an Array is Sorted (Strictly Increasing) using Recursion
• Example: Input: [1, 2, 3, 4, 5] -> Output: True
4. Check if a String contains only Digits using Recursion
• Example: Input: '12345' -> Output: True
5. Count the Number of Zeros in a Number using Recursion
• Example: Input: 102030 -> Output: 3
6. Convert a Decimal Number to Binary using Recursion
• Example: Input: 10 -> Output: 1010
7. Reverse the Digits of a Number using Recursion
• Example: Input: 1234 -> Output: 4321
8. Reverse a Linked List using recursion
9. Reverse an Array using recursion
10. Merge Two Sorted Lists using recursion
Instructions:
- Avoid loops; use recursion only.
- Clearly define the base and recursive cases.
- Ensure your code handles edge cases such as 0, single-digit numbers, and negative
numbers.