Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3: (30 Marks) Given three groups of boxes A, B, and C of n boxes each, where the shapes of the boxes are different.

Question 3: (30 Marks) Given three groups of boxes A, B, and C of n boxes each, where the shapes of the boxes are different. The capacity of each box is measured in milliliter (ml). The list of boxes' capacities in Group A is exactly randomly repeated in Group B and C. This means that for each box in Group A there exist a corresponding box in Group B and C that hold the same capacity, but we do not know which box would match with the other in group A, B and C. Your mission is to find a smart way to match these boxes. For example: Input: capacity in milliliter Group 1 2 3 4 5 6 7 8 A 140 120 150 100 170 200 90 180 B 170 150 140 90 100 120 180 200 C 120 90 200 150 180 140 100 170 Output: A[1] with B[3] with C[6] A[2] with B[6] with C[1] A[3] with B[2] with C[4] ... and so on a) Using a brute-force approach, design an algorithm to solve this problem, and analyze its complexity (3+2 marks) b) Design a more efficient algorithm to solve this problem, and analyze its complexity [Hint: you can use any data-structure] (6+4 marks) c) Implement your efficient algorithm using Python (10 marks) d) brief report comparing the two algorithms (5 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Constitutional Law Cases Materials And Problems

Authors: Russell L. Weaver, Steven I. Friedland, Richard D. Rosen

5th Edition

1543830447, 978-1543830446

More Books

Students also viewed these Law questions