![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a disk file which contains 370,260 records of average length 60 ASCII text characters. I need to sort them on the first 9 characters, which are set off from the rest by a space. Once sorted the first record looks like 100100100 08:35-08:39 4 0 0 1 -115 -1 75 -100 dd17.txt and the last one looks like 500900900 12:41-13:25 44 1 885 0 0 1 925 -200 dd21.txt There is not enough memory in my Win2K/SP4 system to implement the traditional memory-based sorting algorithms, so I need to use a method that is disk-file based. I have plenty of disk space. I imagine that this method would open the input disk file and begin reading records one at a time and performing some kind of sort algorithm placing the result in a temporary output file. Once the original file has been swept, the process starts over and runs again and again for the required number of iterations until the entire list is sorted in ascending order. I will implement this method in standard DOS-based C (Microsoft Optimizing C Compiler "cl") using the Win2K DVM. Suggestions and references please. -- "Nothing in the world can take the place of perseverance. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent." --Calvin Coolidge |
#3
| |||||
| |||||
|
|
There is not enough memory in my Win2K/SP4 system to implement the traditional memory-based sorting algorithms, so I need to use a method that is disk-file based. I have plenty of disk space. I imagine that this method would open the input disk file and begin reading records one at a time and performing some kind of sort algorithm placing the result in a temporary output file. Once the original file has been swept, the process starts over and runs again and again for the required number of iterations until the entire list is sorted in ascending order. I will implement this method in standard DOS-based C (Microsoft Optimizing C Compiler "cl") using the Win2K DVM. I think a variation of Radix sort would work nicely. |
|
your description of programming in C. (newsgroups are arranged by topic for a reason.) |
|
OTOH, you posted this in comp.databases so I'll now assume you want a DB oriented answer. |
|
And that answer would be to pick a DBMS that runs on your platform |
|
(WIN2K is pretty old), |
#4
| |||
| |||
|
|
On 13 Apr 2007 07:43:19 -0700, "Ed Prochak" <edprochak (AT) gmail (DOT) com wrote: |
|
(WIN2K is pretty old), "old" == "dependable", "reliable", "functional". It works, which is more than can be said about the newer versions of Windows. |
#5
| |||
| |||
|
|
legacy (adj) - A pejorative term used in the computer industry meaning "it works." |

#6
| |||
| |||
|
|
I think a variation of Radix sort would work nicely. |
#7
| |||
| |||
|
|
I have a disk file which contains 370,260 records of average length 60 ASCII text characters. I need to sort them on the first 9 characters, which are set off from the rest by a space. Once sorted the first record looks like 100100100 08:35-08:39 4 0 0 1 -115 -1 75 -100 dd17.txt and the last one looks like 500900900 12:41-13:25 44 1 885 0 0 1 925 -200 dd21.txt There is not enough memory in my Win2K/SP4 system to implement the traditional memory-based sorting algorithms, so I need to use a method that is disk-file based. I have plenty of disk space. I imagine that this method would open the input disk file and begin reading records one at a time and performing some kind of sort algorithm placing the result in a temporary output file. Once the original file has been swept, the process starts over and runs again and again for the required number of iterations until the entire list is sorted in ascending order. I will implement this method in standard DOS-based C (Microsoft Optimizing C Compiler "cl") using the Win2K DVM. Suggestions and references please. -- "Nothing in the world can take the place of perseverance. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent." --Calvin Coolidge |
#8
| |||
| |||
|
|
On 13 Apr 2007 07:43:19 -0700, "Ed Prochak" <edprochak (AT) gmail (DOT) com wrote: I think a variation of Radix sort would work nicely. I wrote the C program and it works beautifully. I ended up using the LSD instead of the MSD because I wanted an ascending sort order. I sort a total of 370,260 records with the key 9 digits long. The disk-file-based program runs to completion in 30 seconds. Now I want to sort another data set but this time the key consists of a 4 digit number that can be either plus or minus and I want a descending sort order. Any suggestions on how to use the Radix Sort on that data set. -- "Nothing in the world can take the place of perseverance. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent." --Calvin Coolidge How about just using the whole number + 10000 to select the random |
#9
| |||
| |||
|
|
Try using a bubble sort. |
#10
| |||
| |||
|
|
I imagine that this method would open the input disk file and begin reading records one at a time and performing some kind of sort algorithm placing the result in a temporary output file. Once the original file has been swept, the process starts over and runs again and again for the required number of iterations until the entire list is sorted in ascending order. I will implement this method in standard DOS-based C (Microsoft Optimizing C Compiler "cl") using the Win2K DVM. |
![]() |
| Thread Tools | |
| Display Modes | |
| |