Question: IN C LANGUAGE, USE RECURSION Problem 3 (48 points): Suppose that you have been assigned the job of buying the plumbing pipes for a construction

IN C LANGUAGE, USE RECURSIONIN C LANGUAGE, USE RECURSION Problem 3 (48 points): Suppose that youhave been assigned the job of buying the plumbing pipes for a

Problem 3 (48 points): Suppose that you have been assigned the job of buying the plumbing pipes for a construction project. Your foreman gives you a list of the varying lengths of pipe needed, but the distributor sells stock pipe only in one fixed size. You can, however, cut each stock pipe in any way needed. Your job is to figure out the minimum number of stock pipes required to satisfy the list of requests, thereby saving money and minimizing waste For example, if the vector contains [ 4, 3, 4, 1, 7, 8 ] and the stock pipe length is 10, you can purchase three stock pipes and divide them as follows: Pipe 1: 4, 4, 1 Pipe 2: 3,7 Pipe 3: 8 Doing so leaves you with two small remnants left over. There are other possible arrangements that also fit into three stock pipes, but it cannot be done with fewer. This one is tricky, and we expect you will mull over it for a while before you have a solution. Here are a few hints and specifications: You may assume that all the requests are positive and do not exceed the stock length. In the worst case, you will need N stock pipes, where N is the size of the vector. Problem 3 (48 points): Suppose that you have been assigned the job of buying the plumbing pipes for a construction project. Your foreman gives you a list of the varying lengths of pipe needed, but the distributor sells stock pipe only in one fixed size. You can, however, cut each stock pipe in any way needed. Your job is to figure out the minimum number of stock pipes required to satisfy the list of requests, thereby saving money and minimizing waste For example, if the vector contains [ 4, 3, 4, 1, 7, 8 ] and the stock pipe length is 10, you can purchase three stock pipes and divide them as follows: Pipe 1: 4, 4, 1 Pipe 2: 3,7 Pipe 3: 8 Doing so leaves you with two small remnants left over. There are other possible arrangements that also fit into three stock pipes, but it cannot be done with fewer. This one is tricky, and we expect you will mull over it for a while before you have a solution. Here are a few hints and specifications: You may assume that all the requests are positive and do not exceed the stock length. In the worst case, you will need N stock pipes, where N is the size of the vector

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!