Write an algorithm to output the minimum possible time

Assignment Help Other Subject
Reference no: EM132348209

Assignment -

The fulfillment builder will provide an estimate about the time it will take for the item to be created based on the size of each of the parts.thw worker can only combine two parts at a time. The time required to put two parts together is equal to the sum of the parts sizes. The size of the newly constructed part is also equal to the sum of the part's sizes. This process is repeated until of the parts have been merged together to form the final product.

Write an algorithm to output the minimum possible time to put the n parts together and build the final product.

Input

The input to the faction/method consists of two arguments:

numOfParts ,an integer representing the number of the parts;

parts,alist of integers representing the size of the parts.

Output - Return an integer representing the minimum time required to assemble all the parts.

Constraints

2<=numOfParts<=10^6

1<=parts[i[<=10^6

0<=i<=numOfParts

Example -

input:

numOfParts=4

parts=[8,4,6,12]

output:

56

Explanation: The optimal way to merge the sub files is as follows:

Step 1: Assemble the parts of size 4 and 6 (time required is 10). Size of remaining parts after merging [8,10,12].

Step 3:Assemble the parts of size 18 and 12 (time required is 30).

Total time required to assemble the parts is 10+18+30=58.

Code:

import java.util.list

public clss Solution{

int minimumTime(int numOfParts,List<Integer> parts)

{

//write your code here

}

}

Reference no: EM132348209

Questions Cloud

Performing a physical assessment of the community : Assessment/Interview: Select a community of interest in your region. Perform a physical assessment of the community. Perform a direct assessment of a community.
Polymorphism and the use of interfaces : Demonstrate skills in designing and implementing an information system - two sample input-outputs are given at the Appendix section
What might be some of ramification of living without purpose : What might be some of the ramifications of living without purpose? How might having purpose in life impact the way people live their daily lives,
Explain how you would characterize their corporate strategy : Examine the corporate Web site for your selected company and explain how you would characterize their corporate strategy.
Write an algorithm to output the minimum possible time : Assignment - Write an algorithm to output the minimum possible time to put the n parts together and build the final product
Why is effective and frequent communication : Why is effective and frequent communication so critical to a successful change effort? Describe either a good or a bad example of this from your organization
Which of the following is the most appropriate factor : Level 3 Advanced Certificate in Procurement and Supply Operations- AC4 - Inventory and logistics operations-Which of the following describes class C items?
Write an algorithm to help james find the sets of foreground : Write an algorithm to help James find the sets of foreground and background application pairs that optimally utilize the given device
Type of organisation and the industry sector : Managers should be able to outline the environmental or sustainability legislation, regulations and codes of practice applicable to the organisation

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd