You only need one class for this assignment. Please name your file Recursive.java. Please name your 6 methods as follows:
Of course, methods beginning with r are recursive forms, and those beginning with i are iterative (or at least non-recursive). You may create a second binarySearch method that takes extra parameters in order to pass the
You should test the efficiency between the 3 pairs of methods. I suggest you do this in the main() method of Recursive, and report your findings in /* comments */ in your Recursive.java file. But, if you prefer, you can instead write how you tested your methods and your findings in a separate text file.
11 Sept 03: Normally when you test recursive verses iterative functions, you give each version the same very large input and see which takes longer to return an answer. With this particular assignment, you run into problems doing that, since the factorials quickly overflow the datatype. (You can use the java class BigInterger to get around this if you want to.) Instead of using big input, you can use normal input and just run the method many times. Timing the method also helps. For example:
This assignment will be out of 10 points. You will get points for the following:
|~ztomasze Index :
TA Details: ICS211: Assignment 2
|Last Edited: 11 Sep 2003|
©2002 by Z. Tomaszewski.