comp.lang.ada
 help / color / mirror / Atom feed
From: bwefler@my-dejanews.com
Subject: Re: Doubly linked list (again, sorry)
Date: 1998/12/17
Date: 1998-12-17T00:00:00+00:00	[thread overview]
Message-ID: <75bqb0$a9f$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 3677A69C.C197C703@eucmax.sim.ucm.es

(scroll down to *** for my message) bw

In article <3677A69C.C197C703@eucmax.sim.ucm.es>,  Ricardo Palomares
=?iso-8859-1?Q?Mart=EDnez?=  <ricardo@eucmax.sim.ucm.es> wrote:

> Matt Tyler wrote:
>
> > Hello.
> >
> > I have created a doubly linked list. With the procedure (body only)
> >
> > List:=3Dnew cell'(V,Next=3D>, Prev=3D>null);
> >
> > (...)
> >
> >
> > To loop from start of list do I need to create a (say) Start_of_list ac=
> cess
> > type to the first cell in the list or is there a more elegant way that =
> I am
> > missing.
>
>     You should have a pointer to the first element of the list and other =
> to the
> last one. You also need another pointer to the current element when walki=
> ng
> through the list.
>
> > Also, when I remove (to delete) a record from the list do I have to
> > de-allocate the memory occupied by the object or is it done for me.
>
>     You need to de-allocate it. I can't recall it right, but it has to do=
>  with
> Unchecked_Deallocation package or similar. Anyway, read the end of my mes=
> sage.
>
> > I am sorry to waste your time but I am having a few problems with acces=
> s
> > types. Thanks in advance
>
>     You seem to have some lack of knowledge about the basics of the
> double-linked lists, rather than implementing it in Ada. Perhaps you may =
> wish to
> give a look to some data structure or programming books (Knuth: "Data str=
> uctures
> + Algorithms =3D Programs" IIRC, or Schultz: "Data Structures"; there is =
> a long
> time since I had my hands over these books and the title may be inaccurat=
> e).
> Anyway, the newsgroups are to help us each other.
>

*** A good book (if you can still get it) I used in data structures class is
"Data Structures with Abstract Data Types and Ada", Stubbs & Webre, 1993 PWS
Publishing company. ***


>     About the double-linked list, I wrote a generic package to implement
> double-linked list with n indexes (ie, n different pairs of pathways to r=
> un
> through the list; think of every element as a link of a chain: then, ever=
> y index
> lets you put the links in a different order to form the chain). The gener=
> ic
> package lets you use any data type. It is not really a fast implementatio=
> n,
> because due to the nature of the package, you can't access directly to th=
> e
> pointer type; instead, you have an identifier to which you refer always y=
> ou need
> to access a specific element, and internally to the package the list is w=
> alked
> until the element is found.
>
>     So, if you have big trouble implementing a double-linked list I can s=
> end the
> code to you (the identifiers and comments are in spanish, but I can trans=
> late
> the more important things if you want).
>
> HTH
>
> --
> Ricardo Palomares Mart=EDnez -------- mailto:ricardo@eucmax.sim.ucm.es
> UCM - Servicio Inform=E1tico Gesti=F3n -- http://www.ucm.es/info/gstwsig
>
>


--
bw  8-{)

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1998-12-17  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-16  0:00 Doubly linked list (again, sorry) Matt Tyler
1998-12-16  0:00 ` Ricardo Palomares Martínez
1998-12-17  0:00   ` bwefler [this message]
1998-12-17  0:00   ` Mats Weber
1998-12-18  0:00     ` Ricardo Palomares Martínez
replies disabled

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