Question: Please provide a detaield explanation. 4. (9 pts) Algorithm design. Airline's cargo department often has the task of transporting a group of cargo items (represented

Please provide a detaield explanation.
Please provide a detaield explanation. 4. (9 pts) Algorithm design. Airline's cargo

4. (9 pts) Algorithm design. Airline's cargo department often has the task of transporting a group of cargo items (represented by a non-negative integer array) from one city to another (say, city A to city B). ne cargo run is defined as one flying action from city A to city B. Now, the only available cargo aircraft owned by the airline has 1) a weight limit (which is guaranteed to be larger than any of the cargo item in the array), and 2) it can at most carry 2 cargo items for one cargo run, provided the sum of the weight of these two cargo items are smaller or equal to the weight limit. Design an algorithm with the best possible performance to calculate the minimum number of cargo runs needed to transport every given cargo item from city A to B. Example 1: Cargo items: int items[] - ( 4, 3, 3, 1 }, cargo flight weight limit: 4 Output of your algorithm: 3 cargo runs Explanation: the minimum number of cargo runs has to be 3: one for cargo item (4), one for (3, 1), one for (3)} Example 2: Cargo items: int items[] = { 5, 2, 4, 7, 1), cargo flight weight limit: 7 Output of your algorithm: 3 cargo runs Explanation: the minimum number of cargo runs has to be 4: one for cargo item {7), one for (5,1}, one for (4,2} What to answer here: (a). do not write code to implement your algorithm, but very briefly and clearly describe the steps in your algorithm. For each step, also write down the performance (6 pts): (b). what is the performance of your algorithm (2 pts)

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!