lecture02BMerge - CSE 331 Notes on Merging Merge sort;...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
05/07/09 Stockman CSE/MSU S08 CSE 331  Notes on Merging Merge sort; implementing set  operations; collation of master and  transaction files 
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
05/07/09 Stockman CSE/MSU S08 Topics to be covered Collation/merging of two ordered  sequences Merge sort Merge of master and transaction files Implementation of set operations of  intersection and union
Background image of page 2
05/07/09 Stockman CSE/MSU S08 Basic merge operation 1  13  24  26 2  15  27  38 Select  smaller 1  2  13  15  24  26  27  38 A B C If  A[I] <= B[J]  // determine smallest then C[++K] = A[I++]; // select A[I] else C[++K] = B[J++]; // select B[J]
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
05/07/09 Stockman CSE/MSU S08 Merge step INPUT: two ordered sequences (could  be more than two) of lengths L1 and L2 OUTPUT: one ordered sequence of  length L1+L2 containing all the  elements of both L1 and L2 STORAGE:  2 * (L1 + L2) elements RUNTIME: O(L1+L2), since each  element is selected once
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

lecture02BMerge - CSE 331 Notes on Merging Merge sort;...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online