Answered You can buy a ready-made answer or pick a professional tutor to order an original one.
Algorithm
In this weeks summary, the dispatch department has contacted you with a new problem. Once they receive a new order, they have to look for each product's availability in the existing warehouses. The preference is to ship from the minimum amount of warehouses and to always ship from the warehouse that contains the maximum amount of units.
For example, review the following order (number 10333) that was received by the dispatch department this morning:
Product ID
Amount
0001
10
0005
12
0003
3
0002
4
Be sure to also review the following diagram that shows the warehouse and the list of available products:
Warehouse 1
Warehouse 2
Warehouse 3
Product 001
10
3
100
Product 002
0
7
6
Product 003
3
4
1
Product 004
4
4
4
Product 005
7
1
4
The ideal shipment would be as follows:
Product ID
Units
Warehouse
0001
10
1
0005
7
1
1
2
4
3
0003
3
2
0002
4
2
Complete the following:
- What approach would you follow to create an algorithm to solve this particular problem? Brute force or greedy? Explain the logic that you follow for your choice.
- Present the algorithm either using pseudocode or a flowchart.
Save your Word document as “yourname_WK4.docx”. Click the “Edit” button on this submission node to submit the saved document.
Here are some tips if you have problems to submit your Word document:
- @
- 6 orders completed
- ANSWER
-
Tutor has posted answer for $10.00. See answer's preview
******************************************************************** ****** **** *** ******************** ***** ******* ******** the data for *** ***** ********* ** *** lesson ** -------------------------------------------------------------------------------------------------------------------------------- ** ******* assume **** **** ******* ** the ******************** ***** ** * record that contains *** ******* ** **** ******* *********** **** ******* ******* **** ******************************************************************************************************************************** **** Further ****** **** **** element in *** Warehouse[] ***** is * ****** **** ******** **** *** ****** | | | | ******* amount; **** | | but ** ******* ** **************** *** *********** ** *************************** **** *********************************************************************************** ******************** 3 int number_of_orders_unfulfilled = ** ** **** would normally be ** input ************** ************ = ******* ******************* * **************************** * ********************* ** ** ****** **** ** ** *** get **** ** ***************** ********************* * ***************************************************************************************************************************************** Greedy Algorithm ** *** ** ***** ** ****** ******* ** Warehouse-1 first then 2 and **** 3 ****** ************************************************************************************************************************************** ***************** * ** **************** ***** ********************* ******************* **************************************************************************************************************** ********* if there is ****** ******* in the current ********* ** ******* *** order | | If *** **** **** ***** ** and go ** the **** ********* *************************************************************************************************************** ************* **** ***************************** {total_number_of_loops * ********************* * **** ********************** **** max_number_of_loops)return; // **** *** ******** -- ** ****** ******* the ***** ** ** ****** ***** *** ***************** * ******************************************* ** For readabilityorder_amount = *************************************** // *** ************* (amount ***** ********************************************** {// ***** is ****** ******* ** this ********* ** fill **** part ** *** order// Decrease *** ****** of product in this warehousewarehouseamount[warehouse_number][product_ID] ********************************************** *** ************* ** ***** out ** *** inner for-loop ** ********* to *** next ************** {// ***** ** *** enough ******* in **** ********* to completely **** **** ******* Take **** **** **** *** ** ** *** **** *********************************************** *************************************** *** ********************************************* ********************************************** * *************** = order_number * 1;} ** ************ ****************** ** ********************* ********** (order_number **** ******************************** ***** *** still **** ****** ** ******* -- ***** back ** *********** *** *** to fill the **** of the orderwarehouse_number = ** ** The ******** **** ********* **** ******** ** ** // **********