[LCP]linked list question

Vincent Penquerc'h Vincent.Penquerch at artworks.co.uk
Wed Apr 3 01:40:05 UTC 2002


> Now I found that when allocating new nodes it would be 
> quickest to add 
> them on the head-end rather than the tail-end. Obviously with the 
> disadvantage, of the nodes appearing in reverse.

It may not apply, but using a double linked list (eg ptrs to both
previous and next node) would make the speed question solved, with
a minimal memory overhead (eg one ptr per attachment is probably
very negligible).
Moreover, since you'll most likely use some kind of malloc, and
that the number of attachments probably won't go to the hundreds,
the time spent walking the list will be dwarved by the the other
processing.

-- 
Vincent Penquerc'h 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20020403/e597a282/attachment.htm 


More information about the linuxCprogramming mailing list