Question: 6. (5 points) (Dynamic Programming) You are given a set of n envelopes, where the ith envelope has dimensions a; x b;. One envelope can

6. (5 points) (Dynamic Programming) You are given a set of n envelopes, where the ith envelope has dimensions a;" x b;". One envelope can fit another if you can rotate the envelopes such that after the rotation both sides of the inner one are strictly smaller than the outer one. For example, a 20" x 30" envelope can fit a 25" x 15" envelope. However a 20" x 30" envelope cannot fit a 20" x 20" envelope. Your goal is determine the maximum number of envelopes that can be nested. For example, suppose the dimensions of envelope 1 to envelope 4 is: Envelope 1: 38" Envelope 2: 30' Envelope 3: 10' Envelope 4: 30" x 34" x 40" x 20') x 35" Then, the maximum number of nested envelopes is 3. This is achieved by putting envelope 3 inside envelope 4, which is put inside envelope 1 after rotating envelope 1. (a) Given n envelopes, show how to re-arrange the envelops in an order that the ith envelop cannot contain the jth envelop for every i, j such that isi j
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
