15.22
Suppose you have to compute
as well as . Describe how to compute these together using a single sorting of .
First we sort relation
Then we perform the following:
address of first tuple of- Let
be an empty set. At the end of this algorithm it will contain the result of . - Let
be an empty set. At the end of this algorithm it will contain the result of . tuple to which points .- while (
null) tuple to which points .- Set
to point to the next tuple of . .- while (not
and null)- $t_r’’ := $ tuple to which
points. - If (
)- Set
to point to the next tuple of .
- Else
- $t_r’’ := $ tuple to which
- If (
OR $pr = $ null) .