Java Question: Disk space AnalysisPlease advise the code in Java 7 or 8 2. Disk Space Analysis
Fantastic news! We've Found the answer you've been seeking!
Question:
Java Question: Disk space AnalysisPlease advise the code in Java 7 or 8
Transcribed Image Text:
2. Disk Space Analysis A company is performing an analysis on the computers at its main office. The computers are spaced along a single row. For each group of contiguous computers of a certain length, that is, for each segment, determine the minimum amount of disk space available on a computer. Return the maximum of these values as your answer. Example n = 4, the number of computers space=[8, 2, 4, 6] x = 2, the segment length The free disk space of computers in each of the segments is [8, 2], [2, 4], [4, 6]. The minima of the three segments are [2, 2, 4]. The maximum of these is 4. Function Description Complete the function segment in the editor below. segment has the following parameter(s): int x: the segment length to analyze int space[n]: the available hard disk space on each of the computers Returns: int: the maximum of the minimum values of available hard disk space found while analyzing the computers in segments of length x Constraints . ● ● ✓ Input Format for Custom Testing The first line contains an integer, x, the segment length for analyzing the row of computers. The second line contains an integer, n, the size of the array space. Each line i of the n subsequent lines (where 0 ≤i Input Format for Custom Testing The first line contains an integer, x, the segment length for analyzing the row of computers. The second line contains an integer, n, the size of the array space. Each line i of the n subsequent lines (where 0 ≤i ▾ Sample Case 1 Sample Input STDIN 231 LL 1 1 1 Function → length of segments x = 2 → size of space n = 3 space = [1, 1, 1] → Sample Output Explanation The segments of size x = 2 are [1, 1] and [1, 1]. The minimum value for both segments is 1. The maximum of these values is 1. ▾ Sample Case 2 Sample Input STDIN 3 00 NUU 5 2 5 6 8 4 Function → length of segments x = 3 size of space n = 5 → space= [2, 5, 4, 6, 8] → Sample Output Explanation The segments of size x = 3 are [2, 5, 4], [5, 4, 6], and [4, 6, 8]. The respective minimum values are 2, 4, and 4. The maximum of these values is 4. 4 2. Disk Space Analysis A company is performing an analysis on the computers at its main office. The computers are spaced along a single row. For each group of contiguous computers of a certain length, that is, for each segment, determine the minimum amount of disk space available on a computer. Return the maximum of these values as your answer. Example n = 4, the number of computers space=[8, 2, 4, 6] x = 2, the segment length The free disk space of computers in each of the segments is [8, 2], [2, 4], [4, 6]. The minima of the three segments are [2, 2, 4]. The maximum of these is 4. Function Description Complete the function segment in the editor below. segment has the following parameter(s): int x: the segment length to analyze int space[n]: the available hard disk space on each of the computers Returns: int: the maximum of the minimum values of available hard disk space found while analyzing the computers in segments of length x Constraints . ● ● ✓ Input Format for Custom Testing The first line contains an integer, x, the segment length for analyzing the row of computers. The second line contains an integer, n, the size of the array space. Each line i of the n subsequent lines (where 0 ≤i Input Format for Custom Testing The first line contains an integer, x, the segment length for analyzing the row of computers. The second line contains an integer, n, the size of the array space. Each line i of the n subsequent lines (where 0 ≤i ▾ Sample Case 1 Sample Input STDIN 231 LL 1 1 1 Function → length of segments x = 2 → size of space n = 3 space = [1, 1, 1] → Sample Output Explanation The segments of size x = 2 are [1, 1] and [1, 1]. The minimum value for both segments is 1. The maximum of these values is 1. ▾ Sample Case 2 Sample Input STDIN 3 00 NUU 5 2 5 6 8 4 Function → length of segments x = 3 size of space n = 5 → space= [2, 5, 4, 6, 8] → Sample Output Explanation The segments of size x = 3 are [2, 5, 4], [5, 4, 6], and [4, 6, 8]. The respective minimum values are 2, 4, and 4. The maximum of these values is 4. 4
Expert Answer:
Related Book For
Introduction to Operations Research
ISBN: 978-1259162985
10th edition
Authors: Frederick S. Hillier, Gerald J. Lieberman
Posted Date:
Students also viewed these electrical engineering questions
-
JAVA PROGRAMMING / CODE IN JAVA 3. Create a binary expression tree for a postfix expression. 4. Write a program to evaluate a postfix expression and convert a postfixexpression to infix expression.
-
Java 7 adds syntax that allows a switch statement to work with the String type (instead of the primitive integer types). Explain how hash tables can be used by the compiler to implement this language...
-
In Exercises 7 and 8 of Chapter 4 you worked with data on sales for a line of skiwear that is produced by HeathCo Industries. Barbara Lynch, product manager for the skiwear, has the responsibility of...
-
E-max sold Dishwashers on credit, worth OMR 55,000 to customers, out of these Dishwashers customers return damaged Dishwashers for OMR 6,000. Record the entry for the Dishwashers returned? a. Debit...
-
Hurricane Corporation is financed with debt, preferred equity, and common equity with market values of $20 million, $10 million, and $30 million, respectively. The betas for the debt, preferred...
-
Identify and briefly explain the main classifications of event marketing.
-
Describe sources of funds for investing.
-
Accounting Change Ramirez Co. decides at the beginning of 2010 to adopt the FIFO method of inventory valuation. Ramirez had used the LIFO method for financial reporting since its inception on January...
-
1. Distinguish between direct finance and indirect finance. Give some examples of institutions who are engaged in direct finance and who are engaged in indirect finance. 2. As an investor of your...
-
Donaldson Company has two service departments (personnel and financial) that provide services for one another as well as for two production departments, assembly and finishing. Data for the month...
-
Question 3: What three audit development steps should be used for developing tests of controls and substantive tests?
-
An electrometer consists of two conducting spheres, each with a mass of 2.5 g attached by very thin (massless) conducting wires of length 5.3 cm. The electrometer is initially uncharged (left) and...
-
6. Create the relational schema based on the following E-R diagram. ICLocation ICld ICName INVESTMENT COMPANY |++ Manages MFId MFName MFInceptionDate MUTUAL FUND Includes AmtIncluded Sld SName...
-
Showing the details, find all solutions or indicate that no solution exists. (a) 4y+ z = 0 (b) 5x-3y+ z = 7 -8x (c) +2z = 1 12x-5y3z = 34 2x + 3y z = 0 6y+4z = 3 - -6x +4z = 8 8x+9y-3z = 2 12x + 2y =...
-
Pause the simulation and move the ladybug's companion (the beetle) to be next to her but closer to the edge of the revolving turntable. Click play and notice the beetle's velocity and acceleration....
-
Find all critical numbers of the foll wing function f(t) = 6t/5 8t2/5
-
Month Madison Cookies Sophie Electric 123456 -0.02 0.09 0.05 -0.02 -0.07 -0.13 0.10 0.18 -0.02 -0.07 0.04 Compute the following. Do not round intermediate calculations. Round your answers to four...
-
List four items of financial information you consider to be important to a manager of a business that has been operating for a year.
-
Consider the transportation problem having the following parameter table: 523 4-425-2 0-3-638 -2 | 2 | 743| 3 1-324-3 123
-
Consider the following gamblers ruin problem. A gambler bets $1 on each play of a game. Each time, he has a probability p of winning and probability q = 1 p of losing the dollar bet. He will continue...
-
Reconsider Prob. 17.7-6. Management has adopted the proposal but now wants further analysis conducted of this new queueing system. (a) How should the state of the system be defined in order to...
-
Paramount Corporation acquired its 75 percent investment in Sun Corporation in January 2012, for \($2,910,000,\) and accounts for its investment internally using the complete equity method. At the...
-
Below are the pre-combination condensed balance sheets of Princecraft and Sylvan Companies just prior to Princecrafts acquisition of 90 percent of the voting shares of Sylvan for \($43\) million in...
-
On January 1, 2013, Palomar Resorts acquired 65 percent of the stock of Sahara Hotel & Casino for \($41.45\) million in cash and stock. The date-of-acquisition fair value of the noncontrolling...
Study smarter with the SolutionInn App