Article View: demon.ip.developers
Article #76Re: Newshistory checking
From: Nikki Locke
Date: Thu, 15 Jul 1999 00:00
Date: Thu, 15 Jul 1999 00:00
32 lines
2617 bytes
2617 bytes
In article <E114lUb-0000o6-00@jes.noc.nl.demon.net>, Jim Segrave wrote: > In article <VA.000067fc.00f71953@trmphrst.demon.co.uk>, > Nikki Locke <nikki@trmphrst.demon.co.uk> wrote: > > If you use a hash table that stores a linked list of ID's with the same > > hash in each node, then you can read the file forwards, but insert new > > ID's at the front of each list. Reading the file forwards is obviously > > easier, and adding something to the front of a singly linked list is > > faster than adding it to the end. It's not often that you can make a > > design decision that reduces code and increases efficiency at the same > > time! > > Just to be pedantic, it's a trivial mod to keep track of where the end > item of a linked list is, so appending to the end of a linked list is > really insignificantly more expensive. Nonetheless, your suggestion is > a good one. I can be as pedantic as almost anyone :-) A classic singly linked list does not have an end pointer. You can modify the classic list to include an end pointer, or you can make it a circular list with only an end pointer - both methods dramatically increase the efficiency of adding items to the end of the list, at the expense of a few extra lines of code. However, being truly pedantic, adding things to the front of a classic list is (ever such a tiny bit) more efficient than adding things to the end of either kind of modified list, and uses less code. And it is significantly more efficient than adding things to the end of a classic list. -- Nikki Locke, Trumphurst Ltd. PC & Unix consultancy & programming nikki@trmphrst.demon.co.uk http://www.trumphurst.com/
Technical Details
Message-ID:
<VA.00006802.0324d887@trmphrst.demon.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<19990713.200500.0AA80202.PEaa@pierrot.co.uk> <m3908kgtjk.meow@hopf.demon.co.uk> <19990714.001917.0AA80202.Q3aa@pierrot.co.uk> <VA.000067fc.00f71953@trmphrst.demon.co.uk> <E114lUb-0000o6-00@jes.noc.nl.demon.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10bb05,75d5f9974c0fd91a X-Google-Attributes: gid10bb05,public From: Nikki Locke <nikki@trmphrst.demon.co.uk> Subject: Re: Newshistory checking Date: 1999/07/15 Message-ID: <VA.00006802.0324d887@trmphrst.demon.co.uk> X-Deja-AN: 501500412 Content-Transfer-Encoding: 8bit X-NNTP-Posting-Host: trmphrst.demon.co.uk:158.152.8.60 References: <19990713.200500.0AA80202.PEaa@pierrot.co.uk> <m3908kgtjk.meow@hopf.demon.co.uk> <19990714.001917.0AA80202.Q3aa@pierrot.co.uk> <VA.000067fc.00f71953@trmphrst.demon.co.uk> <E114lUb-0000o6-00@jes.noc.nl.demon.net> Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 932076676 nnrp-02:9479 NO-IDENT trmphrst.demon.co.uk:158.152.8.60 Organization: Trumphurst Ltd. Mime-Version: 1.0 Reply-To: nikki@trmphrst.demon.co.uk Newsgroups: demon.ip.developers