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...
-
Stock R has a beta of 1.5, Stock S has a beta of 0.75, the expected rate of return on an average stock is 15 percent, and the risk-free rate of return is 9 percent. By how much does the required...
-
A coin on a table is given an initial horizontal velocity such that it ultimately leaves the end of the table and hits the floor. At the instant the coin leaves the end of the table, a ball is...
-
In December 2008, Jason Garcia signed a motor vehicle sales contract with Mac Haik Dodge Chrysler Jeep, a dealer. In the contract, Garcia agreed to purchase a 2009 Dodge Ram 1500. The contract...
-
R. C. Coleman distributes a variety of food products that are sold through grocery store and supermarket outlets. The company receives orders directly from the individual outlets, with a typical...
-
Discuss each of the following terms: (a) data (b) database (c) database management system (d) database application program (e) data independence (f) security (g) integrity (h) views 2. What is...
-
You are working on a free-form Packet Tracer challenge activity as seen in Figure 1, you have been given the London Railways network.' The purpose of this EMA question is to build upon each of the...
-
natural language processing Consider the following very simple CNF, annotated with respect to phrasal coverage of the symbols on the right-hand side of each rule, Grammar rules S Noun VP // [1]...
-
You work on a proprietary trading desk of a large investment bank, and you have been asked for a quote on the sale of a call option with a strike price of $49 and one year of expiration. The call...
-
Using these data from the comparative balance sheet of Oriole Spice Company is presented below. Prepare a schedule showing a horizontal analysis for 2021 using 2020 as the base year. (Round...
-
Statement of cost of goods manufactured for a manufacturing company Cost data for Johnstone Manufacturing Company for the month ended March 31 are as follows: Inventories Materials Work in process...
-
Gunco Industries invests a large sum of money in R&D; as a result, it retains and reinvests all of it earnings. In other words, Gunco does not pay any dividends and it has no plans to pay dividends...
-
Mariota Corp. just paid a dividend of $3.90 per share on its stock. The dividend growth rate is expected to be 3.6 forever and investors require a return of 12.8 percent on this stock. What will the...
-
Planet Corporation owned 90% interest in a purchased subsidiary, Sally Company, which was accounted for by the cost method. During year 2019, Planet had income, of P435,000, and Sally had a net...
-
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...
-
______________ occur(s) when the speaker should pause but instead fills the silence (umm, ahh).
-
Identify an election (federal, state, or local) for which a debate was broadcast. Analyze how the different speakers were able to adapt their messages based on the moderators questions and their...
-
___________ refers to your credibility as a presenter as well as the credibility of the information delivered in your presentation.
Study smarter with the SolutionInn App