Question: Create a pseudocode for an algorithm to find the near optimal solution to the following problem: Suppose we have n number of trench coats and
Create a pseudocode for an algorithm to find the near optimal solution to the following problem:
Suppose we have n number of trench coats and n number of students then we must assign each trench coat to each student by minimizing the difference between the trench coat height and student height s.t
where h_i = height of student and t_i = height of the trench coat
For example, if we have the array array h_i = {3,5,5,6,} and t_i = {4,3,5,3,}, then we'd want near optimal solution where s.t
student 1 with a height of 3 ft has trench coat with a height of 3ft so that |h_i - t_i| = 0
student 2 with a height of 5 ft has trench coat with a height of 5ft so that |h_i - t_i| = 0
student 3 with a height of 5 ft has trench coat with a height of 3ft so that |h_i - t_i| = 2
student 4 with a height of 6 ft has trench coat with a height of 4ft so that |h_i - t_i| = 2
where the difference between the heights are near 0.
|hStep by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
