My Blog List

External Sort

1. External Sort

The simplest one 'two way merge sort".
First pass. Use in memory sort to sort records within each page.
Following passes. (Assume using 3 pages of memory 2 as input buffer and 1 as output buffer). 
           1. Merge every two pages into one 
           2. Merge every four pages into one
           3. Merge every eight pages into one
   Each time use input buffer to read from one source. Read next page when the records run out in input buffer. When output is full write it into disk and clear it.

2. qiqiguaiguaide
  1. sizeof ( float) == 4
  2. struct{ char[3] } . The size of this structure is 4 because of alignment
  3. struct { char [3], int , float, char [0] }. The usage of char [0]
  4. Extern C

No comments:

Post a Comment

Enter you comment