Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. 4. ** please use java programming for solution ** /* * Input Parameters: * -seg: a non-empty array of integers * Assumptions: - Input

3.

image text in transcribed

4.

image text in transcribed

** please use java programming for solution **

/* * Input Parameters: * -seg: a non-empty array of integers * Assumptions: - Input array seg is not empty. What to return? Return another array of strings, each of which denoting a non-empty suffix of the input array. A suffix of array `seq' contains its last n elements (where 1 Then the output or returned array of string values is: where each suffix is structured as a comma-separated list surrounded by square brackets. Note that the length of the output array is equal to the length of the input array. Also, elements in the output array are sorted by the lengths of the suffixes. (e.g,. the last element is the suffix of length' 1, the second last element is the suffix of length 2). * See the JUnit tests related to this method. */ public static String[] task3(int[] seq) { String[] result = null; . /* Your task is to implement this method, * so that running TestUtilities.java will pass all Junit tests. * * Recall from Week 1's tutorial videos: * 1. No System.out.println statements should appear here. Instead, an explicit, final return statement is placed for you. * 2. No Scanner operations should appear here (e.g., input.nextInt()). Instead, refer to the input parameters of this method. * 3. Do not re-assign any of the parameter/input variables. */ * // Your implementation of this method starts here. // Do not modify this return statement. return result; } * Input Parameters: sa': an array of strings * * Assumptions: - Input array `sa' is non-empty and contains at least one elements. * - The string value that appears the most frequently is unique. * * What to return? - Return the string value that appears the most frequently, * i.e., appear for the highest number of times. * * See the JUnit tests related to this method. */ public static String task4(String[] sa) { String result = null; /* Your task is to implement this method, * so that running TestUtilities.java will pass all JUnit tests. * * Recall from Week 1's tutorial videos: * 1. No System.out.println statements should appear here. Instead, an explicit, final return statement is placed for you. * 2. No Scanner operations should appear here (e.g., input.nextInt()). * Instead, refer to the input parameters of this method. * 3. Do not re-assign any of the parameter/input variables. */ * // Your implementation of this method starts here. // Do not modify this return statement. return result; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

How do people respond to cultural diff erences in communication?

Answered: 1 week ago