Skip to content

CDEguia/CMPS-460

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CMPS-460

Polyphase Sort/Merge

Data is moved from the large file into two (min 3 when using PFD) external drives

Perfect Fibonacci Distribution PFD

Finding the PFD

The following Fibonacci numbers of order 3 are found by adding the 3 previous numbers together.

F1T1T2T3
1100
3111
5221
9432

An alternative method for finding the next row of numbers is:

F1T1T2T3
9432
anbncn
an+bnbn+cnan
17764

Minimize the number of phases!

When the number of records does not equal one of the Fibonacci numbers

If the number of records wo be sorted is 12 and the PFD order is 3, the Fibonacci number 17 must be used.

Adding dummy records

Dummy records can be added to the beginning of the file or the end.

Example Run:

PDF Menu

Enter the file size: 10001

PFD of order: 7

Sort # F1 T1 T2 T3 T4 T5 T6 T7
10001 -- -- -- -- -- -- --
1 -- 2000 1984 1952 1888 1761 1508 1004
2 1004 996 980 948 884 757 504 --
3 500 492 476 444 380 253 -- 504
4 247 239 223 191 127 -- 253 251
5 120 112 96 64 -- 127 126 124
6 56 48 32 -- 64 63 62 60
7 24 16 -- 32 32 31 30 28
8 8 -- 16 16 16 15 14 12
9 -- 8 8 8 8 7 6 4
10 4 4 4 4 4 3 2 --
11 2 2 2 2 2 1 -- 2
12 1 1 1 1 1 -- 1 1
13 -- -- -- -- -- 1 -- --

About

Polyphase Sort Merge using the Fibonacci Distribution

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages