Chapter 8: Intro to Recursion – More Basic Exercises

Classwork and homework assignments

  • 1. Write a program, sumRec_YI.java with a recursive method to calculate the sum of the first N numbers.
  • 2. Write a program, binarySearchRec_YI.java, with a recursive method to find an integer in an integer array of N elements.
  • 3. Write a program, palindromeWordTestRec_YI.java, with a recursive method to determine if a word is a palindrome. It returns a boolean.
  • 4. Write a program, palindromeSentenceTestRec_YI.java, with a recursive method to determine if a sentence is a palindrome. It returns a boolean.