Answered step by step
Verified Expert Solution
Question
1 Approved Answer
// receives: list - array of ints and numElements - count of values in array list // returns: nothing // task: sorts list into ascending
// receives: list - array of ints and numElements - count of values in array list // returns: nothing // task: sorts list into ascending order (smallest to largest) public static void sortints(int [] list, int numElements) // receives: strList - array of Strings and numElements - count of values in array // returns: nothing // task: sorts list into ascending order (smallest to largest) according to name // case in-sensitive public static void sortStrings(String [] strList, int numElements) // receives: strList - array of String // numElements - count of values in array strList // strToFind - String to find index of in strList, case in-sensitive // returns: index of strToFind (first occurrence) in strList, -1 if NOT found // task: find string (case ignored) return index if found, - 1 if not public static int find(String [] strList, int numElements, String strToFind) Here is a general sorting algorithm (insertion sort) to use in your sort methods (adjust names and compares and temp used in swap). Insertion Sort ALGORITHM // assumes array of integers with numElements as #values in array to sort for(int index = 1; index 0) { if(array[k]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started