Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!bloom-beacon!eru!kth.se!cyklop.nada.kth.se!news From: d88-jwa@byse.nada.kth.se (Jon W{tte) Newsgroups: comp.sys.mac.programmer Subject: Re: How to best do a linked list on Mac Message-ID: Date: 14 Jun 91 06:53:38 GMT References: <1991Jun10.002416.5656@gn.ecn.purdue.edu> <14026@goofy.Apple.COM> <1991Jun13.181159.23906@linus.mitre.org> Sender: news@nada.kth.se (Mr News) Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 24 In-reply-to: laf@mitre.org's message of 13 Jun 91 18:11:59 GMT > 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. -- Jon W{tte h+@nada.kth.se - Speed !