🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.borland
Article #591

Re: *NOT* a homework assignment!

#591
From: Dr John Stockton
Date: Sun, 15 Mar 1998 00:00
39 lines
2620 bytes
JRS:  In article <35063D3E.2FC763F8@geocities.com> of Wed, 11 Mar 1998
02:29:02 in comp.lang.pascal.borland, etc, etc (too many groups,
including non-existent), Stephen Chrzanowski <_pontiac_@geocities.com>
wrote:

>I've got a LARGE text file that I want to sort line by line.  (Like over
>2000 entries)  Conventional routines are sorta outta the question, when
> ...

As you have posted to c.l.p.b, I assume TP/BP; and c.l.p.m is therefore
a bad choice.

They are URLs.  The average URL is under 80 characters; 2000*80 = only
160000; so read the lines into a full string and copy each to a New on
the Heap of the right size.

while not EoF(F) do begin
  Readln(F, S) ; P := GetMem(Succ(Length(S)) ; P^ := S end ;

Obviously, P must be a different variable each time, say in an array of
pointers.  Then do a Quicksort.  If I can slow-sort 275 strings on a
486/33 in a few seconds, you should be able to Quicksort fast enough.

Or, for quickest programming, how about reading them into a TV
TSortedCollection?  You can use collections without needing the visual
parts of TV.

>Thanks a bunch.  If/when I get this completed, I'll post full source in
>all PASCAL channels I can get to.

Only if it is short/interesting, please; otherwise use a FTP or WWW
site.
 
-- 
John Stockton, Surrey, UK.    jrs@merlyn.demon.co.uk    Turnpike v1.12    MIME.
  Web <URL: http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
  Correct 4-line sig separator is as above, a line comprising "-- " (SoRFC1036)
  Do not Mail News to me.    Before a reply, quote with ">" or "> " (SoRFC1036)
Technical Details
Message-ID: <H7YdPAA3H$C1EwvQ@merlyn.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35063D3E.2FC763F8@geocities.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11185f,9be3e88e4f192d
X-Google-Attributes: gid11185f,public
X-Google-Thread: fd1d1,9be3e88e4f192d
X-Google-Attributes: gidfd1d1,public
X-Google-Thread: 111659,9be3e88e4f192d
X-Google-Attributes: gid111659,public
X-Google-Thread: 10261c,9be3e88e4f192d
X-Google-Attributes: gid10261c,public
X-Google-Thread: ff90a,9be3e88e4f192d
X-Google-Attributes: gidff90a,public
X-Google-Thread: 102601,9be3e88e4f192d
X-Google-Attributes: gid102601,public
From: Dr John Stockton <jrs@merlyn.demon.co.uk>
Subject: Re: *NOT* a homework assignment!
Date: 1998/03/15
Message-ID: <H7YdPAA3H$C1EwvQ@merlyn.demon.co.uk>
X-Deja-AN: 334321118
Distribution: world
X-NNTP-Posting-Host: merlyn.demon.co.uk [158.152.233.145]
References: <35063D3E.2FC763F8@geocities.com>
Organization: Home, Surrey, UK
MIME-Version: 1.0
Newsgroups: comp.lang.pascal.borland,de.comp.lang.pascal,ctdl.lang.pascal,fj.lang.pascal,osu.pascal,comp.lang.pascal.misc