5 8 4 7 8 6 4 OUTPUT: 4

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

INPUT:
5 8
4
7
8
6
4

OUTPUT:
4

The computing labs want to slowly reopen! In the beginning, the university wants us to maintain
certain capacity rules.
For these rules, we need to determine the number of machines in a lab. A lab with M machines can
support M students working in the lab at the same time. On a given day, there are N students
wanting to use the computing lab where N is less than 15,000. Each student's order to use the lab is
1 to N. For example, student 1 is fırst to appear in the lab. Each student i plans to use a computer
for a specific length of time d(i).
At the beginning of the day, students 1 through M are in the lab working. When the first of these
students finishes their work, they will leave and then the next student M+1 immediately begins
working, and so on. There are always M students working, until the end of the day, when there are
less students waiting to use a computer.
The computing lab is open until the last student finishes her work, at time T. The more computers
available, obviously requires fewer total hours the lab is open, T. Each day, the university tells the
computing lab a set maximum hours the lab can be opened, Tmax: Based on this number, the
computing lab has to make available M computers. For the day, determine the smallest possible
number of computers M that the computing lab should have available, given the constraint Tmax-
Solution requirements:
• Use pseudocode as close to Java code (i.e. no English explanations)
• BufferedReader, PrintWriter, StringTokenizer can be referred to in your pseudocode to handle the
file format. I will not be taking off points for incorrect syntax/usage of these - refer/use them to
read the input file.
• Hint: You can use Java's priority queue (ie don't implement a heap).
• State the runtime of your algorithm:
• You will be given partial points based on how: pseudocode usage, understanding of the problem
shown in your code. You will receive extra credit if you have the most optimized algorithm.
Upload a doc, docx, pdf, java, txt, etc so I can see your pseudocode.
INPUT FILE FORMAT:
The first line is N and Tmax.
The next N lines are working times d(1)..d(N) for each student 1...N. Each d(i) value is an integer less
than 1,000,000.
If M=N, the show will finish in time.
OUTPUT FORMAT:
Return an integer which represents the smallest possible value of M such that the student working
times will take no more than Tmax units of time.
Transcribed Image Text:The computing labs want to slowly reopen! In the beginning, the university wants us to maintain certain capacity rules. For these rules, we need to determine the number of machines in a lab. A lab with M machines can support M students working in the lab at the same time. On a given day, there are N students wanting to use the computing lab where N is less than 15,000. Each student's order to use the lab is 1 to N. For example, student 1 is fırst to appear in the lab. Each student i plans to use a computer for a specific length of time d(i). At the beginning of the day, students 1 through M are in the lab working. When the first of these students finishes their work, they will leave and then the next student M+1 immediately begins working, and so on. There are always M students working, until the end of the day, when there are less students waiting to use a computer. The computing lab is open until the last student finishes her work, at time T. The more computers available, obviously requires fewer total hours the lab is open, T. Each day, the university tells the computing lab a set maximum hours the lab can be opened, Tmax: Based on this number, the computing lab has to make available M computers. For the day, determine the smallest possible number of computers M that the computing lab should have available, given the constraint Tmax- Solution requirements: • Use pseudocode as close to Java code (i.e. no English explanations) • BufferedReader, PrintWriter, StringTokenizer can be referred to in your pseudocode to handle the file format. I will not be taking off points for incorrect syntax/usage of these - refer/use them to read the input file. • Hint: You can use Java's priority queue (ie don't implement a heap). • State the runtime of your algorithm: • You will be given partial points based on how: pseudocode usage, understanding of the problem shown in your code. You will receive extra credit if you have the most optimized algorithm. Upload a doc, docx, pdf, java, txt, etc so I can see your pseudocode. INPUT FILE FORMAT: The first line is N and Tmax. The next N lines are working times d(1)..d(N) for each student 1...N. Each d(i) value is an integer less than 1,000,000. If M=N, the show will finish in time. OUTPUT FORMAT: Return an integer which represents the smallest possible value of M such that the student working times will take no more than Tmax units of time.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Concept of Light
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education