comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jeffrey.carter@boeing.com>
Subject: Re: List Strawman JC01
Date: Fri, 7 Dec 2001 18:10:14 GMT
Date: 2001-12-07T18:10:14+00:00	[thread overview]
Message-ID: <3C110606.A37E9D10@boeing.com> (raw)
In-Reply-To: uV4Q7.52774$xS6.86977@www.newsranger.com

Ted Dennison wrote:
> 
> Perhaps I am just overreacting, and you are only trying to say that you think
> the strawman doesn't need to be in a package hierarchy?

Perhaps we were talking past each other here. I was discussing this
particular package as a vehicle to allow discussion of alternative names
and items that are still undecided while presenting everything we had
decided. Since the name of the package and the structure and contents of
any hierarchy containing it are still undecided, everything is/should be
presented in the package. I think the time complexity should be
associated with each operation, even if it is summarized elsewhere, in
the interests of locality.

> No its not. Its a basic property of a *singly* linked list. For a doubly-linked
> list, there is no logical "first" element, and working from either end is
> equivalent.

This quote seems to summarize the rest of the post (please correct me if
I'm oversimplifying).

Every data structures text I've seen describes the abstract concept of a
list as an ordered sequence of values with one value considered the
first value, another the next value, and so on to the last value. I
certainly haven't seen every data structures text, but I've seen a few,
and this was a general property of all lists in all of them, regardless
of implementation. Have you seen texts that say otherwise?

Generally, the concept of a list is presented something like:

A list X of length N can be considered an ordered sequence of values
x{i}:

x{1}, x{2}, x{3}, ..., x{N}

x{i} is the value at the ith position; x{1} is the value at the first
position, or first value, and x{N} is the last value.

[I use {i} to indicate what is typeset as a subscript; I chose {} to
emphasize that this is a notational inconvenience, not a programming
language.]

This is usually followed by some discussion of list operations from a
mathematical point of view:

X' = x{1}, ..., x{i-1}, y, x{i}, ..., x{N}

This is sufficiently common that we introduce an insertion function as
shorthand:

X' = ins(X,i,y), 1<=i<=N+1

i=N+1 means y is the last value of X'.

This is then followed by a discussion of using lists in programs;
programming issues, such as modifying one list rather than having lots
of lists that vary by one value; implementation issues
(bounded/unbounded; single/double); and one or more sample
implementations, often partial with the missing operations left as
exercises for the reader.

I have done this from memory because I don't have any texts available,
nor have I found any online. [However, see pp 70 and 72 of file
08Pointers.ppt available at

http://cs.calvin.edu/books/c++/ds/1e/NewPPSlides2/

(lecture slides for use with _C++: Introduction to Data Structures_ by
Larry Nyhoff)

for some evidence that such texts consider first and last elements basic
properties of lists.]

I hope this seems familiar, and would welcome comments from any
professors who teach data structures courses or authors who have written
texts. It's important that a standard list package implement basic list
concepts and properties.

Having learned that an implementation of a list is intended to be a
useful concrete version of this abstraction, and that this abstraction
includes the concepts of first, second, and last values, it seems to me
that it follows that every implementation includes these concepts.
Whether it's called First, Front, Head, or Horvald, every list has a
first element.

Imagine a sequence rotating in space, with one end labeled "First" and
the other end, "Last". How do you know which element is the first?

Of course, if what I learned about lists from multiple texts is wrong,
then so are my conclusions. In the meantime, that's my story and I'm
sticking to it.

-- 
Jeffrey Carter



  parent reply	other threads:[~2001-12-07 18:10 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-05  6:08 List Strawman JC01 Jeffrey Carter
2001-12-05 19:14 ` Ted Dennison
2001-12-06  0:14   ` Jeffrey Carter
2001-12-06  3:15     ` Jeffrey Carter
2001-12-06 16:11     ` Ted Dennison
2001-12-06 17:48       ` Jeffrey Carter
2001-12-07 15:06         ` Ted Dennison
2001-12-07 17:43           ` Stephen Leake
2001-12-07 18:59             ` Ted Dennison
2001-12-09 14:04               ` Mark Lundquist
2001-12-10 15:25                 ` Ted Dennison
2001-12-10 15:46               ` Marin David Condic
2001-12-10 17:12                 ` Ted Dennison
2001-12-07 18:10           ` Jeffrey Carter [this message]
2001-12-07 19:45             ` Ted Dennison
2001-12-07 22:47               ` Basic Properties of Lists Jeffrey Carter
2001-12-09 14:04                 ` Mark Lundquist
2001-12-09 18:16                   ` Chad R. Meiners
2001-12-09 21:21                   ` Jeffrey Carter
2001-12-10 15:37                   ` Ted Dennison
2001-12-10 22:13                     ` Jeffrey Carter
2001-12-11 14:33                       ` Ted Dennison
2001-12-09 14:04           ` List Strawman JC01 Mark Lundquist
2001-12-10 17:02             ` Ted Dennison
2001-12-10 17:13               ` Ted Dennison
2001-12-10 15:37           ` Marin David Condic
2001-12-10 16:10             ` Larry Hazel
2001-12-06 19:09       ` Stephen Leake
2001-12-06 22:45         ` Jeffrey Carter
2001-12-07 16:54           ` Ted Dennison
2001-12-07 17:18             ` Darren New
2001-12-07 17:44               ` Doubly-linked list ordering(s) (was: List Strawman JC01) Ted Dennison
2001-12-07 17:30         ` List Strawman JC01 Ted Dennison
2001-12-06 19:34     ` Mark Lundquist
2001-12-07 17:04       ` Ted Dennison
2001-12-07 22:27         ` Jeffrey Carter
2001-12-09 14:04         ` Mark Lundquist
2001-12-06 19:34   ` Mark Lundquist
2001-12-06 23:09 ` Nick Roberts
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox