Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 7 9 Max. score: 2 0 . 0 0 Partitioning the Servers A local cloud services provider CLTech offers On Demand Services ( ODS
Question
Max. score:
Partitioning the Servers
A local cloud services provider CLTech offers On Demand Services ODS for customers to host their operations on CLTechs servers.
Customers send requests for resources to CLTech as and when they require them. Each request can be represented as a list of strings, requestid requeststarttime, requestendtime
Example Request
::::
Description of Fields in a Request:
requestid: A unique ID is given to each request, which is used to trace the origin of the request.
request starttime: The time when the serving of the request needs to begin, if the request is served and not rejected The request is allocated a partition of the resources beginning at the time. Time is given in hh:mm:ss format.
requestendtime: The time when the serving of the request ends. The request occupies the resource till requestendtime, after which it is freed.Time is given in hh:mm:ss format.
Being a private organization, CLTech has limited resources memory and computational resources hence, it has to utilize them intelligently and efficiently.
Specifically, assume that a fixed amount of memory and processors are in possession of CLTech.
In order to meet the demands of its large customer base, it has to create partitions VMs or containers of the resources. At the beginning of each day, a certain number of partitions K are created, which will be used to serve all requests in the upcoming day. The number of partitions K is chosen to be the maximum number of concurrent requests that were served on the previous day. That is at max, K requests were served at a single instant on the previous day.
Note
A successful request is allotted the server from the requeststarttime to therequestendtime inclusively.
Task
Given the successful requests that were served from yesterday, find K the number of partitions that CLTech must make today.
Example
Assumptions
N
::::
::::
::::
::::
::::
Approach
The maximum concurrent requests that occur during a particular time duration are requests, namely stnd and rd These occur in the time interval ::::
So answer is
Function description
Complete the functionsolveprovided in the editor. This function takes the following parameters and returns the required answer:
N: An integer representingthe number of requests
R:A list of N lists, where each list represents a successful request of the formatrequestid requeststarttime, requestendtime
Input format
Note: This is the input format that you must use to provide custom input available above theCompile and Testbutton
The first line contains a single integerNdenoting the number of successful requests.
The next N lines contain the N requests. Each line contains spaceseparated integers requestidrequeststarttime, requestendtime which represent a request
Output format
Print K thenumber of partitions that CLTech must make today.
Constraints
in
Length of requestid is less than for each request
Code snippets also called starter codeboilerplate code
This question has code snippets for C CPP Java, and Python.
Sample input
::::
::::
::::
Sample output
Explanation
The maximum number of concurrent successful requests in the given input is They occur between time intervals::::: and also between time intervals:::::
So the answer is
The following test cases are the actual test cases of this question that may be used to evaluate your submission.
Sample input
::::
::::
::::
::::
::::
::::
::::
::::
::::
Sample output
View more
Sample input
::::
::::
::::
::::
::::
::::
::::
::::
::::
Sample output
View more
Note:
Your code must be able to print the sample output from the provided sample input. However, your code is run against multiple hidden test cases. Therefore, your code must pass these hidden test cases to solve the problem statement.
Limits
Time Limit: secs for each input file
MemoryQuestion
Max. score:
Partitioning the Servers
A local cloud services provider CLTech offers On Demand Services ODS for customers to ho
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started