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 A denoting

please let me know about the answer!
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. Example Assumptions - 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 - Noter 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 function takes the following 3 parameters and returns the 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 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 1T101N106 1Ai,Bi109 Code snippets (also called starter code/boilerplate code) This question has code snippets for C, CPP, Java, and Python

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions