Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please let me know about the answer! Servers You are given the following: - N servers, initially all disconnected from each other - Cost array

please let me know about the answer! image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Servers You are given the following: - N servers, initially all disconnected from each other - Cost array A denoting the cost array for the servers if used as a microservice instance - Cost array B denoting the cost array for the servers to be used as a monolith instance Each server can be used to make a microservice or joined with other adjacent servers (servers whose index differ by to make an instance of monolith architecture. Notes - A monolith architecture will require at least two adjacent server instances. - A single server can be used as a microservice - The cost of a monolith architecture is the sum of costs of servers described by array B, present in it. Task Determine the minimum cost to use all the servers for implementing the client/server system. - T=1 - N=5 servers A=[3,5,2,1,9] B=[1,1,10,5,3] Approach - Use first and second servers as monolith instances with cost=1+1. - Use the third server as a microservice instance with cost = 2. - Use fourth and fifth servers as monolith instances with cost =5+3 - Note: You cannot use only the 4 th or 5 th servers for monolith instances. - Hence, Total cost =1+1+2+5+3=12. Therefore, the answer is 12. Function description Complete the MinCost function provided in the editor. This minimum cost of assembly: N. Represents the number of servers A: Represents the cost for microservice implementation of the servers B: Represents the cost for monolith instance implementation of the servers Input format Note: This is the input format that you must use to provide custom input (available above the Compile and Test button). - The first line contains a single integer T which denotes the number of test cases. T also denotes the number of times you have to run the MinCost function on a different set of inputs. - For each test case: - The first line contains an integer N denoting the number of servers. - The second line contains N space-separated integers denoting the cost for the microservice implementation of the servers as A. - The third line contains N space-separated integers denoting the cost for the monolith implementation of the servers as B. Output format For each test case, print an integer value in a new line representing the minimum cost to use all the servers for implementing the client/server system. Constraints 1T10 1N106 1Ai,Bi109 Code snippets (also called starter code/boilerplate code) This question has code snippets for C, CPP, Java, and Python. The first line denotes the number of test case, T=1 The first test case - You can make the first and second servers to be microservice. - You can make the third, fourth, and fifth servers to be part of a monolith as instances. - You can make sixth and seventh servers to be microservice. - You can make eighth, ninth, and tenth servers to be part of a monolith as instances. Hence, total minimum cost is 1+2+1+1+1+2+1+1+1+1=12. The answer is 12. The following test cases are the actual test cases of this question that may be used to evaluate your submission. Sample input 1 Sample output 1 Sample input 2 Sample output 2

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

Database Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

More Books

Students also viewed these Databases questions

Question

Have ground rules been established for the team?

Answered: 1 week ago

Question

a. How are members selected to join the team?

Answered: 1 week ago

Question

b. Will new members be welcomed?

Answered: 1 week ago