quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryعلوم الحاسوب schoolبكالوريوس event_available2026-07-15

السؤال

Transcribed Image Text:

Question 2: (40 Marks) Given a group of boxes carried on a fork lift truck, it is requested to arrange these boxes on top of each other to reach the minimum possible height. To enable the driver to control the stability of the boxes, it is mandatory that a box "X" cannot be placed on top of another box "Y" unless the 2D base area of X is less than or equal to 2D base area of Y. It is allowed to rotated any box to use any two sides as its base. 2 Minimum Height For example, consider below 3 boxes where each box has the following dimensions Input: Box 1: (9,3,6), Box 2: (2,3,7), Box 3: (6,4,10) Output: From bottom to top as follows: Box 3 on the base (6,10) and height 4, then Box 1 on the base (6,9) and height 3 finally, on top Box 2 on the base (3,7) and 3/4 The total height is 9 [Explanation: as we can see that the first box in the bottom is the box 3 with base 6x10 and height 4, then box 1 with base 6x9 and height 3, and so on. This arrangement of boxes fulfils the stability constraint and also satisfies the minimum possible height] Assume the existence of n boxes, answer the following questions: a) Describe how a brute-force approach algorithm would solve the above problem (5 marks), and explain its complexity (5 marks). b) Design a more efficient algorithm to solve this problem. Explanation and pseudo code should be provided (10 marks). Analyze the complexity of your solution. (5 marks) [full explanation of your answer should be provided] c) Implement Both of the above algorithm using Python (10 marks) d) Prepare a brief report (250 words max) to describe the difference between the performance of the two algorithm in case of big number of input boxes. (5 Marks)

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top