Re: Linked Lists
- Posted by jzeitlin at cyburban.com Aug 13, 2001
- 647 views
On Mon, 13 Aug 2001 08:17:04 -0700, Derek Parnell <ddparnell at bigpond.com> wrote: >----- Original Message ----- >From: "Chris Bensler" <bensler at telus.net> >To: "EUforum" <EUforum at topica.com> >Sent: Monday, August 13, 2001 10:24 PM >Subject: Linked Lists >> can someone tell what a linked list is? >A linked list is a list in which each element is "linked" to the next >logical element. The logical sequence of the list is not necessarily the >same as the physical sequence. It usually is in some sorted order. [Extensive examples deleted] The key thing about linked lists in other languages is that they are dynamic structures, allocated and expanded as needed rather than its resources being statically declared at compile/load time. In Euphoria, given that sequences already have this characteristic, I don't see a real need for linked lists - any operation you can do on a linked list, I believe I can do on a sequence, and usually it'll be clearer what I'm doing with the sequence, and will require less code. The advantage to a double-linked list in other languages is that it can be traversed in either direction; again, this is something I can do with sequences in Euphoria. I think that some people here - not all, by any means - fail to realize just how useful the sequence data type is - most of the structures that one learns about in first- or second-semester Computer Science classes (stacks, queues, linked lists, trees, etc.) can be implemented fairly easily using sequences - or don't need to be implemented in Euphoria, because a sequence is more efficient. More, some complex data structures that appear in only a few specialized languages (e.g., the association list of LISP) can also be implemented fairly easily in Euphoria using sequences as a base. (Watch this space; I am going to look at the data structure includes I wrote some time ago, and re-release them, cleaned up if necessary. The current versions of them are in the archive as zeitlin.zip, a bad choice of name.) -- Jeff Zeitlin jzeitlin at cyburban.com (ILink: news without the abuse. Ask via email.)