Question: Use good decomposition ( i . e . functions with arguments and / or return values ) to solve the following problems in java. You

Use good decomposition (i.e. functions with arguments and/or return values) to solve the following problems in java.
You may choose how to populate arrays/lists with values (i.e. hard-coded, randomly generated, read from a file, specified on the command line, or entered interactively. Use sufficient messages so that the programs user knows what to do.
You may use primitive arrays or ArrayLists. If no data type is specified, you can use any type.
You may implement all the solutions in a single, menu-driven client, implement separate solutions in different programs, or group solutions as you see fit.
1. Determine true or false whether an array (or list) has duplicates. The duplicated values need not be adjacent. Demonstrate your solution on lists with and without duplicates.
2. Determine true or false whether an array (or list) is sorted in ascending order. Demonstrate your solution on sorted and unsorted lists.
3. From two arrays (or lists) of the same data type, produce a list containing only those elements that belong to both of the originals.
4. From an array (or list) of numbers (either integers or doubles), find the starting index of the longest strictly ascending subsequence. For example, given the array
{12,3,7,5,9,8,1,4,10,2}
the result is 6, since the subsequence {1,4,10} starts at index 6 and is the longest that is strictly increasing. If the list does not have a strictly ascending subsequence (e.g. the list is in descending order), return a negative value.
5. Starting with a String and a single character, produce a list of the indexes in the string where the character occurs. For example, given the string bookkeeper and 'e, the function would return {5,6,8} since e occurs at those positions. Return an empty list if the character does not appear in the string at all.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!