Get A+ with YaClass!

Register now to understand any school subject with ease and get great results on your exams!

### Theory:

Sorting Method:

Let us learn the sorting methods of packing by considering a situation.

Situation:

A food delivery company delivers food in motorcycles. Each motorcycle can carry a maximum load of \(30 kg\). The parcels that are to be delivered are given below with their weights.

Food | \(1\) | \(2\) | \(3\) | \(4\) | \(5\) | \(6\) | \(7\) | \(8\) | \(9\) |

Weight of the food in \(kg\) | \(16\) | \(20\) | \(8\) | \(14\) | \(7\) | \(6\) | \(2\) | \(5\) | \(12\) |

To solve this situation, we have to remember the two conditions:

- The minimum number of motorcycles to be used.
- None of the food item's weights can be split.

Under this kind of circumstances, the sorting method of packing is used.

There are two types of sorting methods. They are:

- First-fit method
- First-fit decreasing method

Before we discuss the above two methods, we need to find the minimum number of motorcycles required to solve this situation.

The minimum number of motorcycles required is calculated as follows:

Total weight of the food \(=\) \(16\) \(+\) \(20\) \(+\) \(8\) \(+\) \(14\) \(+\) \(7\) \(+\) \(6\) \(+\) \(2\) \(+\) \(5\) \(+\) \(12\)

\(=\) \(90\)

The maximum load of each motorcycle \(=\) \(30 kg\)

Therefore, the minimum number of motorcycles required \(=\) \(\frac{90}{30}\)

\(=\) \(3\)

Here the minimum requirement of motorcycles may or may not be the answer to this problem. \(3\) motorcycles may or may not be enough to carry all the food items.

*First-fit method*:

**\(1\): Take the parcels of food items in the order given.**

*Step*Food | \(1\) | \(2\) | \(3\) | \(4\) | \(5\) | \(6\) | \(7\) | \(8\) | \(9\) |

Weight of the food in \(kg\) | \(16\) | \(20\) | \(8\) | \(14\) | \(7\) | \(6\) | \(2\) | \(5\) | \(12\) |

**\(2\): Place each parcel of food items in the first motorcycle and continue trying to fit them in each motorcycle where there is still space for each parcel until all the parcels are placed, as shown in the table below.**

*Step*Motorcycle \(1\) | Motorcycle \(2\) | Motorcycle \(3\) | Motorcycle \(4\) | |

\(16\) \(kg\) | \(20\) \(kg\) | \(14\) \(kg\) | \(12\) \(kg\) | |

\(8\) \(kg\) | \(7\) \(kg\) | \(5\) \(kg\) | ||

\(6\) \(kg\) | \(2\) \(kg\) | |||

Total load in the motorcycle in \(kg\) | \(30\) \(kg\) | \(29\) \(kg\) | \(19\) \(kg\) | \(12\) \(kg\) |

Remaining load in each motorcycle in \(kg\) | \(0\) \(kg\) | \(1\) \(kg\) | \(11\) \(kg\) | \(18\) \(kg\) |

In the above table, observe the following:

Food \(1\) - \(16\) \(kg\): Place it in the first motorcycle so that the remaining capacity is \(14\) \(kg\).

Food \(2\) - \(20\) \(kg\): Place it in the second motorcycle so that the remaining capacity is \(10\) \(kg\).

Food \(3\) - \(8\) \(kg\): As there is enough space in the first motorcycle, place it in the first motorcycle so that the remaining capacity is \(6\) \(kg\).

Food \(4\) - \(14\) \(kg\): Place it in the third motorcycle so that the remaining capacity is \(16\) \(kg\).

Food \(5\) - \(7\) \(kg\): As there is enough space in the second motorcycle, place it in the second motorcycle so that the remaining capacity is \(3\) \(kg\).

Food \(6\) - \(6\) \(kg\): As there is enough space in the first motorcycle, place it in the first motorcycle so that the remaining capacity is \(0\) \(kg\).

Food \(7\) - \(2\) \(kg\): As there is enough space in the second motorcycle, place it in the second motorcycle so that the remaining capacity is \(1\) \(kg\).

Food \(8\) - \(5\) \(kg\): As there is enough space in the third motorcycle, place it in the third motorcycle so that the remaining capacity is \(11\) \(kg\).

Food \(9\) - \(12\) \(kg\): Since there is no enough space in all three motorcycles, place it in the fourth motorcycle so that the remaining capacity is \(18\) \(kg\).

Therefore, we need \(4\) motorcycles to carry all the food parcels using this method.

Also, there is \(1\) \(+\) \(11\) \(+\) \(18\) \(=\) \(30\) \(kg\) capacity of remaining space that can be filled.

Here, we can say that the motorcycles are not utilized to the optimum level.

**Pros and cons of the first-fit method**:

- It is an easy and quick method to be followed.
- It is less likely to give an optimal solution.