Answered step by step
Verified Expert Solution
Link Copied!

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
79
Max. score: 20.00
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 3 strings, [request_id, request_start_time, request_end_time].
Example Request
["300.11.4380","03:34:49","05:23:11"]
Description of Fields in a Request:
request_id: A unique ID is given to each request, which is used to trace the origin of the request.
request _start_time: 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.
request_end_time: The time when the serving of the request ends. The request occupies the resource till request_end_time, 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 request_start_time to therequest_end_time 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=5
[["221.005.2333","04:02:31","06:03:32"],
["33.145.322","05:48:11","06:12:13"],
["106.234.42","04:15:55","07:11:48"],
["255.67.888","06:45:36","11:51:58"],
["655.34.899","09:12:00","12:34:29"]]
Approach
The maximum concurrent requests that occur during a particular time duration are 3 requests, namely 1st,2nd and 3rd. These occur in the time interval ["05:48:11",06:03:32"].
So, answer is 3.
Function description
Complete the functionsolveprovided in the editor. This function takes the following 2parameters 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 format[request_id, request_start_time, request_end_time].
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 integerN,denoting the number of successful requests.
The next N lines contain the N requests. Each line contains 3 space-separated integers request_id,request_start_time, request_end_time which represent a request
Output format
Print K, thenumber of partitions that CLTech must make today.
Constraints
1
<=
<=
2
10
5
(
[
]
[
0
]
)
<=
50
,
in
[
0
,
1
]
(Length of request_id is less than 51 for each request)
Code snippets (also called starter code/boilerplate code)
This question has code snippets for C, CPP, Java, and Python.
Sample input
3
202:03:4405:06:07
22103:05:0006:07:11
222205:06:0806:00:00
Sample output
2
Explanation
The maximum number of concurrent successful requests in the given input is 2. They occur between time intervals:-[03:05:00,05:06:07], and also between time intervals:-[05:06:08,06:00:00].
So, the answer is 2.
The following test cases are the actual test cases of this question that may be used to evaluate your submission.
Sample input 1
84241
412.455.2113:42:3013:46:14
597.336.72609:39:2821:22:37
54.589.11006:38:2007:22:15
318.188.44914:22:4823:02:44
562.856.67113:19:4117:18:16
54.47.39810:56:5016:49:50
619.262.66408:20:2616:12:21
5.781.69003:54:3514:13:43
387.303.59723:09:1523:25:47
Sample output 1
29757
View more
Sample input 2
16838
219.196.91518:55:4618:55:49
812.561.28717:38:4422:36:37
922.219.47502:12:2809:53:21
429.722.18200:40:5600:52:07
81.98.94109:43:4114:38:39
737.333.3713:58:5819:23:17
282.564.28512:56:3912:58:19
77.293.70317:36:0919:33:54
949.324.9521:30:3521:46:58
Sample output 2
6024
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: 5.0 sec(s) for each input file
MemoryQuestion
79
Max. score: 20.00
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

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

More Books

Students also viewed these Databases questions

Question

Write the difference between sexual and asexual reproduction.

Answered: 1 week ago

Question

What your favourite topic in mathematics?

Answered: 1 week ago

Question

Briefly describe vegetative reproduction in plants.

Answered: 1 week ago