Implement a searchFromLast

Assignment 10 on Chapter 19Implement a searchFromLast( ) recursive method that looks at the last entry in the array instead of the first one. You may use the search( )method shown below as a reference.public static boolean inArray(T[] anArray, T anEntry)return search(anArray, 0, anArray.length – 1, anEntry); // end inArrayprivate static boolean search(T[] anArray, int first, int last, T desiredItem)boolean found;if (first > last)found = false; // No elements to searchelse if (desiredItem.equals(anArray[first]))found = true;elsefound = search(anArray, first + 1, last, desiredItem);return found; // end searchWhat to submit:1. The including the searchFromLast( ) method implementation2. The file that tests the new method

Leave a Reply

Your email address will not be published. Required fields are marked *