Article View: news.software.nntp
Article #64533Re: Newsreader programming - sorting one million lines ?
From: Heiko Studt
Date: Wed, 26 Mar 2003 11:25
Date: Wed, 26 Mar 2003 11:25
60 lines
3360 bytes
3360 bytes
Juergen Helbing did nothing on 26.03.2003 07:44:07: > I am using always heapsort - because it offers a stable sorting > time even for presorted or reversly persorted lists: But becuase of presorted lists this is *very* bad! A B C D E F G I H would be done (twisted) in nlog(n) to another string and *THEN* it would be done to be sorted in nlog(n) again. With bubble-sort you need only go and look and (at the end!) twist I with H. Perhaps therefor this 'new' algorithmic would be fine: Get the count of items which are 'higher' than the next one and the count of items which are 'lower' than the next one. Now, depending on the result, you can choose wether you use heap-sort (count near '0'), bubble sort in reverse (count very negative eg -1000) or normal bubble sort (count very high eg 1000). This would help to cut the *highest* time (presorting in reverse order) and set it to half (presorting in both halfth of array). But even this could be done in a better way: If you reach a special count (500 or -500) you use this part as a presorted part. Now you go further and get again the special count. This part is again presorted. And so on. Now you can try to reverse those parts which are very low (-500), so they are (+500). At the end you can sort the complete list without too much overhead of changing positions. > A newsreader (my newsreader) is offering all kind of sorting: > Forward and backwards.... And I want to have a constant sorting Forward and backwards are *no* sorting. They are a form of presenting. > time. I believe that users dont like to wait very long.... ACK. > But unfortunately doing the multipart combining requires sorting by > subject. So sorting by subject cannot be done after multipart joining. > Or am I wrong ? "References". I don't fetch binaries, but those should add this header too, don't they? But you will *ever* have to save indexes to prevent users to sort the local database again and again. MFG -- Heiko Studt http://www.goldpool.org/temp/IMAPHamster.zip 20.3.2003 24:00
Technical Details
Message-ID:
<b5s66v.1t4.1@Heiko.Studt.dialin.t-online.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!logbridge.uoregon.edu!newsfeed.vmunix.org!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mailReferences:
<4540d.o33203@archiver.winews.net> <b5ob7g$akq$1@puck.litech.org> <Xns93492FF0660DBnothing@209.98.50.131> <07447.q33209@archiver.winews.net>Show Full Headers
Complete Article Headers
Message-ID: <b5s66v.1t4.1@Heiko.Studt.dialin.t-online.de> Subject: Re: Newsreader programming - sorting one million lines ? Date: Wed, 26 Mar 2003 12:25:02 +0100 From: Heiko Studt <UsenetBecky@goldpool.org> References: <4540d.o33203@archiver.winews.net> <b5ob7g$akq$1@puck.litech.org> <Xns93492FF0660DBnothing@209.98.50.131> <07447.q33209@archiver.winews.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!logbridge.uoregon.edu!newsfeed.vmunix.org!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail Newsgroups: news.software.nntp Organization: HSR Lines: 59 Reply-To: Heiko.Studt@gmx.de Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: news.t-online.com 1048696420 06 2824 YtruErsSkYjDp 030326 16:33:40 X-Complaints-To: abuse@t-online.com X-ID: T80nFoZeQeQ7Ycrvo5VIJHdceTa8JPpdRdysH5GqREb7NUI1D+SNgU X-Mailer: Becky! ver. 2.05.10 with BkNews Plug-In ver. 2.0 User-Agent: Hamster-Pg/1.8