A d-dimensional box with dimensions (x 1 , x 2 , . . . ,x d )

Question:

A d-dimensional box with dimensions (x1, x2, . . . ,xd) nests within another box with dimensions (y1, y2, . . . ,yd) if there exists a permutation π on {1, 2, . . . ,d} such that xπ(1) < y1, xπ(2) < y2, . . . , xπ(d) < yd.

a. Argue that the nesting relation is transitive.

b. Describe an efficient method to determine whether or not one d-dimensional box nests inside another.

c. Suppose that you are given a set of n d-dimensional boxes {B1, B2, . . . ,Bn}.

Give an efficient algorithm to find the longest sequence 〈Bi1, Bi2, . . . ,Bik〉 of boxes such that Bij nests within Bij+1 for j = 1, 2, . . . ,k - 1. Express the running time of your algorithm in terms of n and d.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Introduction to Algorithms

ISBN: 978-0262033848

3rd edition

Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest

Question Posted: