This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 272 Homework Assignment 4 Fall 2008 Due: Dec 3rd, 5:00 PM Do not discuss the problems with anyone other than the instructor or the TA. Submission Instructions : Send your answers to email@example.com with CS272HW4 in the subject. 1. Generate invariants using Daikon. For this problem you are required to implement a class BinarySearchable . This class should have two methods with the following signatures public int sort(int arr) : This method should sort the array arr using Bubble sort and return it. public int binarySearch(int arr, int val) : This method should search for the value val in arr using binary search and return its index. The array should only have positive elements. In case the value cant be found it should return -1. Once you have implemented the above methods write a driver main method in the class that calls these methods with a variety of array lengths and array values and search values (generate the values and the lengths of the arrays and the search values randomly). Now run this class using Daikon and report the invariants you obtain. Do this for two different test sets (i.e., for two different main methods). The first one should be a small test set (saytest sets (i....
View Full Document
- Spring '08