@@ -0,0 +1,2951 @@
+/**%0A * Searching demonstrates various search algorithms on an array %0A * of objects.%0A *%0A * @author Java Foundations%0A * @version 4.0 %0A */%0Apublic class Searching %0A%7B%0A    /**%0A     * Searches the specified array of objects using a linear search%0A     * algorithm.%0A     *%0A     * @param data   the array to be searched%0A     * @param min    the integer representation of the minimum value %0A     * @param max    the integer representation of the maximum value%0A     * @param target the element being searched for%0A     * @return       true if the desired element is found%0A     */%0A    public static %3CT extends Comparable%3CT%3E%3E   %0A%09boolean linearSearch(T%5B%5D data, int min, int max, T target)%0A    %7B%0A        int index = min;%0A        boolean found = false;%0A%0A        while (!found && index %3C= max) %0A        %7B%0A            found = (data%5Bindex%5D.compareTo(target) == 0);%0A            index++;%0A        %7D%0A        return found;%0A    %7D%0A%0A    /**%0A     * Searches the specified array of objects using a binary search%0A     * recursive algorithm.%0A     *%0A     * @param data   the array to be searched%0A     * @param min    the integer representation of the minimum value %0A     * @param max    the integer representation of the maximum value%0A     * @param target the element being searched for %0A     * @return       true if the desired element is found%0A     */%0A    public static %3CT extends Comparable%3CT%3E%3E  %0A%09    boolean binarySearch(T%5B%5D data, int min, int max, T target)%0A    %7B  %0A        boolean found = false;%0A        int midpoint = (min + max) / 2;  // determine the midpoint%0A%0A        if (data%5Bmidpoint%5D.compareTo(target) == 0)%0A            found = true;%0A%0A        else if (data%5Bmidpoint%5D.compareTo(target) %3E 0)%0A        %7B%0A            if (min %3C= midpoint - 1)%0A                found = binarySearch(data, min, midpoint - 1, target);%0A        %7D%0A        %0A        else if (midpoint + 1 %3C= max)%0A            found = binarySearch(data, midpoint + 1, max, target);%0A        return found;%0A    %7D  %0A    %0A    /**%0A     * Searches the specified array of objects using a binary search%0A     * iterative algorithm.%0A     *%0A     * @param data   the array to be searched%0A     * @param min    the integer representation of the minimum value %0A     * @param max    the integer representation of the maximum value%0A     * @param target the element being searched for %0A     * @return       true if the desired element is found%0A     */%0A %0A    public static %3CT extends Comparable%3CT%3E%3E  %0A%09%09boolean binarySearch2(T%5B%5D data, int min, int max, T target)%0A    %7B  %0A        boolean found = false;%0A        int midpoint;%0A        %0A        while(min %3C= max && !found)%0A        %7B%0A            midpoint = (min + max) / 2;  // determine the midpoint%0A            if (data%5Bmidpoint%5D.compareTo(target) == 0)%0A                found = true;%0A            else if (data%5Bmidpoint%5D.compareTo(target) %3E 0)%0A                max = midpoint - 1;        %0A            else %0A                min = midpoint + 1;%0A        %7D            %0A        return found;%0A    %7D%0A%7D%0A

Create searching.java