Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 1st, 2006, 3:07 AM   #11
Adak
Hobby Coder
 
Join Date: May 2006
Posts: 57
Rep Power: 0 Adak is an unknown quantity at this point
Quote:
Originally Posted by sakuntala
Yes Iam supposed to sort thr whole lot into one sorted output text file.
Are the files in this order, although unsorted?

Primary sortkey, secondary sortkey, tertiary sortkey, etc.?

And what is your operating system, pray tell? I'm assuming it's Windows since the file you uploaded appears to be a Windows text file. Just to be sure though.

*YOU* could be in like a porch climber!

I've certainly written, and been quite proud of the result of, a large sorting program that used Quicksort arrays over and over, and finally mergesort, to handle the amount of data that could never be sorted in memory.

But I've also learned that sometimes a very much smaller, (and much easier to maintain) bat file, could do the same thing, in far less time.

I don't want to talk you out of your programming effort - I believe it's a noble one and you'll undoubtedly already have learned a lot from working on it.

This is just an alternative, and much simpler way, imo.

Adak
Adak is offline   Reply With Quote
Old Jun 1st, 2006, 4:08 AM   #12
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 852
Rep Power: 4 The Dark is on a distinguished road
One way to sort the whole lot in your program is to read all the data into one big array, then sort the whole lot.
Do you still need the binary output files?
If not, just read each input file and add the data into a big array (you could use realloc to allocate memory). Then just call qsort once after all the files have been processed.
The Dark is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:23 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC