-
December 1st, 2008, 11:19 AM
#1
sorting
.In a text file there are numbers upto 10 Million randamly...Those numbers should be sorted.How would u do?
Regards
vinni
-
December 1st, 2008, 11:51 AM
#2
Re: sorting
- read numbers from the file into an array
- sort numbers
- write numbers back to the file
Victor Nijegorodov
-
December 1st, 2008, 12:57 PM
#3
Re: sorting
If there are too many numbers to fit in computer memory:
* Divide into portions that do fit
* Sort each portion separately
* Save sorted results to individual files
* Merge the results by reading these sorted files, always picking the smallest number available in any file.
This is called a merge sort
Nobody cares how it works as long as it works
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
|