Click here to Skip to main content
15,917,702 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Monte carlo Rabin_Karp Search Pin
Tim Craig3-Oct-08 18:34
Tim Craig3-Oct-08 18:34 
GeneralArray Rearrangement trick [modified] Pin
abhigad1-Oct-08 9:53
abhigad1-Oct-08 9:53 
GeneralRe: Array Rearrangement trick Pin
CPallini1-Oct-08 10:16
mveCPallini1-Oct-08 10:16 
GeneralRe: Array Rearrangement trick Pin
Alan Balkany2-Oct-08 3:42
Alan Balkany2-Oct-08 3:42 
GeneralRe: Array Rearrangement trick Pin
Mark Churchill2-Oct-08 5:16
Mark Churchill2-Oct-08 5:16 
QuestionDigit combination string [modified] Pin
z33z30-Sep-08 21:25
z33z30-Sep-08 21:25 
QuestionExternal sorting: Which algorithm to select Pin
lizardking3d29-Sep-08 1:45
lizardking3d29-Sep-08 1:45 
AnswerRe: External sorting: Which algorithm to select Pin
Alan Balkany1-Oct-08 3:36
Alan Balkany1-Oct-08 3:36 
Merge sort is the classic way of sorting data that's too large to fit into memory, but shortcuts are possible.

One suggestion: Just read the keys of your records into memory, each paired with the record number it occurs in, e.g.:

(1, key1), (2, key2), ..., (n, keyn).

Then sort these pairs on the keys. When these pairs are sorted, the record numbers will have the sorted order, e.g. the first record number in the sorted pairs will be the record with the lowest key, etc...

Then assuming you can fit k records into memory, read in the k lowest records, write them to your output file, read the next k lowest records, append them to your output file and so on.

When done, your output file will have the sorted data.
GeneralRe: External sorting: Which algorithm to select Pin
lizardking3d5-Oct-08 20:48
lizardking3d5-Oct-08 20:48 
GeneralRe: External sorting: Which algorithm to select Pin
Alan Balkany6-Oct-08 3:29
Alan Balkany6-Oct-08 3:29 
GeneralRe: External sorting: Which algorithm to select Pin
lizardking3d6-Oct-08 4:08
lizardking3d6-Oct-08 4:08 
GeneralRe: External sorting: Which algorithm to select Pin
Alan Balkany6-Oct-08 4:22
Alan Balkany6-Oct-08 4:22 
GeneralRe: External sorting: Which algorithm to select Pin
Mark Churchill6-Oct-08 5:23
Mark Churchill6-Oct-08 5:23 
GeneralRe: External sorting: Which algorithm to select Pin
supercat921-Oct-08 12:49
supercat921-Oct-08 12:49 
GeneralRe: External sorting: Which algorithm to select Pin
lizardking3d22-Oct-08 1:57
lizardking3d22-Oct-08 1:57 
GeneralRe: External sorting: Which algorithm to select Pin
supercat922-Oct-08 7:38
supercat922-Oct-08 7:38 
NewsHuge new prime number discovered Pin
73Zeppelin27-Sep-08 22:41
73Zeppelin27-Sep-08 22:41 
GeneralRe: Huge new prime number discovered Pin
Bassam Abdul-Baki28-Sep-08 15:16
professionalBassam Abdul-Baki28-Sep-08 15:16 
JokeRe: Huge new prime number discovered Pin
Nelek14-Oct-08 0:52
protectorNelek14-Oct-08 0:52 
QuestionScapegoat Tree Issue Pin
loctarar25-Sep-08 2:47
loctarar25-Sep-08 2:47 
Generalsuggest me an algorithm Pin
niconicx22-Sep-08 23:08
niconicx22-Sep-08 23:08 
GeneralRe: suggest me an algorithm Pin
73Zeppelin22-Sep-08 23:14
73Zeppelin22-Sep-08 23:14 
GeneralRe: suggest me an algorithm Pin
Paul Conrad25-Sep-08 7:13
professionalPaul Conrad25-Sep-08 7:13 
GeneralRe: suggest me an algorithm Pin
CPallini27-Sep-08 22:07
mveCPallini27-Sep-08 22:07 
GeneralRe: suggest me an algorithm Pin
PIEBALDconsult21-Nov-08 5:29
mvePIEBALDconsult21-Nov-08 5:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.