Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Disjoint difference We can also define a version of rectangle difference which returns a set of disjoint rectangles. The idea is this. Let the two
Disjoint difference
We can also define a version of rectangle difference which returns a set of disjoint rectangles. The idea is this. Let the two rectangles be dots, and dots, where dots, and dots, are the intervals forming the two rectangles and
To compute the difference as a list of disjoint rectangles, we reason by induction thus writing a recursive solution Consider the coordinate
Let so that is a list consisting of or intervals. Cleady, for any interval LinA, we have that dots, is part of the result.
As for the remaining part of the result, let can be empty, or consist of one interval.
The rest of the result is given by
dots,dots,
It is easier thus to define a generator, which yields all the rectangles in the difference.
Computation of disjoint difference
metitle Computation of disjoint difference
def disjointminus :
unR and are equallength lists of intervals, representing
two rectangles and The function returns, or better, yields,
all the rectangles in the disjoint difference of and w
AIHI YOUR SOLUTION MERE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started