Newsgroups: comp.sys.mac.programmer
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!linus!linus!laf@mitre.org
From: laf@mitre.org (Lee Fyock)
Subject: Re: How to best do a linked list on Mac
Message-ID: <1991Jun14.123719.2765@linus.mitre.org>
Sender: news@linus.mitre.org (News Service)
Nntp-Posting-Host: asgard.mitre.org
Organization: The MITRE Corporation
References: <1991Jun10.002416.5656@gn.ecn.purdue.edu> <D88-JWA.91Jun14085334@byse.nada.kth.se>
Date: Fri, 14 Jun 1991 12:37:19 GMT

In article <D88-JWA.91Jun14085334@byse.nada.kth.se>, d88-jwa@byse.nada.kth.se (Jon W{tte) writes:
> 
> > laf@mitre.org (Lee Fyock) writes:
> 
>    > This works fine but it isn't a linked list -- it's a dynamically sized
>    > array.  It's good as long as all you will do is add elements at the end
>    > or remove them from the end, but it doesn't allow you to add elements
>    > in the middle, or remove them from the middle and reclaim their storage
>    > space.
> 
>    For adding or deleting elements from the middel of an array that has
>    been allocated as a handle, use Munger!  For example, given that filesH
>    is a handle to an array of handles and fileIndex is the index (into the
>    array) of the handle you want to delete from the array,
> 
> Come on guys ! What's wrong with people these days ? You
> can't do that as a general case since the memory move would
> take forever when put to some serious use. The suggested
> method of a handle with offsets in the record, and a free
> list, seems OK. You could have a compaction routine that
> purged the free list and resized the handle on idle time.

Chill out!  The first guy didn't give any conditions about what he wanted
to use the list for.  The array method works spiffy keen (and is very clean)
for lists that aren't altered much.  BTW, what's this list going to be used
for?  Maybe we can kick around some hashed B-tree implementations for
a while!  :-)


Lee Fyock
laf@mitre.org
