Recitation 6

Introduction

Practice writing recursive functions.

Practice Problems

  1. Write a recursive function to compute the minimum element in an array of integers of length n.
  2. Write a recursive method to reverse a String.
  3. Write a recursive function to find the minimum in an array of integers using divide and conquer.
  4. Wite a recursive function to compute N! modulo M. For example ((5!) modulo 11) = ((120) modulo 11) = 10 or ((4!) modulo 7) = ((24) modulo 7) = 3.

For a bare-bones driver program for the above problems: Recitation06.java

Harder Problems

These problems are harder and/or will take a long time to run once you have a solution. However, they are very good practice.

Submission and Grading:

This is for your practice. You should be able to complete some of the functions by the end of recitation. If you complete a function, call the TA over to look over your function to make sure it is correct. If you do not have time to complete the programs before the end of recitation, you have the option of uploading it to CourseWeb once you are finished to receive feedback on it from the TA. If you upload it after Monday, October 19, please email the TA so he knows to look at it.