[futurebasic] Re: Linked Lists

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 1998 : Group Archive : Group : All Groups

From: Jay Reeve <jktr@...>
Date: Tue, 29 Sep 98 00:25:47 +0100
>Peter Bancroft wrote:
>> 
>(snip)
>> 
>> You could implement this as an array.
>> With some of the array elements being the address of the links.
>> 
>This seems to me to be a bad suggestion. The beauty of the linked list is 
>that
>you don't have to worry about free records, remaining space (you have the
>whole heap basically at your disposal), and other administration.
>
>PB

I have nothing against linked lists, but for ease of use, understanding, 
and maintenance, I have just one word (with appologies to the long-timers 
who have heard me say it too often):

XREF@

It gives instant access without "walking" lists. Familiar array format 
(single- or multi-dimensional). Adjusting handle size is (usually) no 
more difficult than creating new handles. MUCH simpler if you want to 
save your records to (or retrieve them from) disk. (Just one handle to 
write/read.) Saves one master pointer, 12 bytes header space and 8 bytes 
of links for each record after the first.

Window-record lists are usually fairly short, and the record itself a bit 
bulky. An obvious case for a linked list. Another would be variable-size 
records. For most any other situation, it's XREF@ for me!
 0"0
 =J= a  y
  "

P.S. I believe my XREF@ demo is still available on the webring.