|
-
April 6th, 1999, 04:11 PM
#1
Sorting
what is the best way to sort 10 million strings, taking into account space & speed constraints . It takes about 5 hours for me now using a UNIX tool..
-
April 6th, 1999, 08:15 PM
#2
Re: Sorting
How are they stored?
*) in memory?
*) in flat file on hard disk?
*) in database?
-
April 6th, 1999, 09:37 PM
#3
Re: Sorting
Hi.
When I took C++ class, my professor told us this.
When we want to sort the data, it is better for us to sort
something whenever we input the data. Otherwise, the sorting time
brings us to waste the time.
In your case, the huge data already exists.
It can't be helped.
Next time, you had better change your program.
Regards.
-Masaaki Onishi-
-
April 7th, 1999, 01:16 PM
#4
Re: Sorting
this would be in a file in the hard disk.
The sorting involves strings. Please suggest an efficient method
-
April 7th, 1999, 07:59 PM
#5
Re: Sorting
try the quicksort rountine or try this :
first open a second file, then read the first string in, second insertion starts to compare with a while loop, enz...
close your file and delete the original and
rename your second file to the first file.
and try to keep your date in memory if you can.
only at the last moment save it...
hope this helps
Luypaert Benny
-
May 16th, 2000, 11:42 AM
#6
Re: Sorting
Hi,
The best possible sort for that much data is the Radix Sort routine. The problem is getting the data from the flat file into memory. I would read the first key into a memory holder and us the file pointer to move up and down the flat file. I hope this helps. ;-)
Later
Ken
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|