[futurebasic] RE: [FB] better queue suggestion desired

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2002 : Group Archive : Group : All Groups

From: tedd <tedd@...>
Date: Fri, 18 Oct 2002 08:28:54 -0400
W.

>upon entering a new value
>gFirstPtr = new value which
>means that I have now 11 entries
>then I make gLastPtr = the 10th
>entry by looking at the previous
>entry and disposing of the 11th
>entry.  So it would need to be a
>double-linked list.

No, it still doesn't have to be a double linked list -- unless you 
want to be able to transverse the list both up and down.

In any event, using a single linked list _requires_ that you know 
where the first address is (gFirstLinkAddr&). If you lose that, then 
you have no way of finding the data stored.

To do what you want (a moving event queue), you can do it two ways; 
a) Make a global that holds the address of the _last_ entry 
(gLastLinkAddr&). Then when you grab the next piece of data, you know 
where to push the new link (each record must a link to the next 
record); b) Or, simply transverse the list and find the last entry. 
While that may seem like a waste of time, it's pretty quick 
especially for only 1000 records. You should try it just to see for 
yourself. If I can sort 1000 names in less than 12 ticks, I know that 
I can transverse a 1000 member linked list in much less time.

tedd
-- 
http://sperling.com/