Question

In: Computer Science

Design a variant of the hybrid merge-join algorithm for the case where both relations are not...

Design a variant of the hybrid merge-join algorithm for the case where both relations are not physically sorted, but both have a sorted secondary index on the join attributes.

Solutions

Expert Solution

//Hybrid join merge Algorithm

pr = address of first tuple of relation r;
ps = address of first of relation s;
while (ps!=null && pr!=null) do begin
         ts = tuple to which ps points;
         Ss = {ts};
        set ps to point the next tuple of relation s;
        done = false;
        while (!done && ps!=null) do begin
                ts? = tuple to which ps points;
                 if (ts?[JoinAttrs] = ts[JoinAttrs])
                   begin
                        Ss = Ss U {ts?};
                        set ps to point the next tuple of relation s;
                        end
                else
                    done = true;
        end 
   tr = tuple to which pr points;
   while (pr !=null && tr [JoinAttrs] < ts[JoinAttrs]) do begin
        for each ts in Ss do begin
              add ts   ⋈    tr to result;
          end
        set pr to point nest tuple of r;
          tr = tuple to which pr points;
         end

Related Solutions

Design and analysis of Algorithms: How do I write a k way merge sort algorithm from...
Design and analysis of Algorithms: How do I write a k way merge sort algorithm from a merge sort algorithm that splits 2 arrays while sorting?
a. State a recent (since 2009) case where government attempted to stop two firms to merge,...
a. State a recent (since 2009) case where government attempted to stop two firms to merge, and explain the reason behind government’s decision unwillingness to allow the merger.    b. Briefly state why monopolies are not desirable?    c. Briefly state two ways monopolies can be beneficial for buyers?      
a. State a recent (since 2009) case where government attempted to stop two firms to merge,...
a. State a recent (since 2009) case where government attempted to stop two firms to merge, and explain the reason behind government’s decision unwillingness to allow the merger.    b. Briefly state why monopolies are not desirable?    c. Briefly state two ways monopolies can be beneficial for buyers?      
Q1) (1 point) Design an efficient algorithm (in terms of asymptotic complexity in the worst case)...
Q1) (1 point) Design an efficient algorithm (in terms of asymptotic complexity in the worst case) to determine if two students in a class of n students have the same height. What is the complexity of your algorithm? a.Provide the pseudo-code of that algorithm. b.Implement the algorithm in a language of your choice and provide a sample run with meaningful input.
case example where both common law and statue law were applied
case example where both common law and statue law were applied
This case presents students with three different situations where they must determine the appropriate research design....
This case presents students with three different situations where they must determine the appropriate research design. 1. Describe what research design you would recommend for each of client. 2. For each research design you selected for the three clients, discuss why you believe your choice of design is the correct choice.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT