From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,955f3216aaa64cc0 X-Google-Attributes: gid103376,public From: bwefler@my-dejanews.com Subject: Re: Doubly linked list (again, sorry) Date: 1998/12/17 Message-ID: <75bqb0$a9f$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 423345276 References: <7580p3$q00@romeo.logica.co.uk> <3677A69C.C197C703@eucmax.sim.ucm.es> X-Http-Proxy: 1.0 x15.dejanews.com:80 (Squid/1.1.22) for client 132.1.207.21 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Thu Dec 17 20:42:08 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/2.0 (compatible; MSIE 3.02; Windows 95) Date: 1998-12-17T00:00:00+00:00 List-Id: (scroll down to *** for my message) bw In article <3677A69C.C197C703@eucmax.sim.ucm.es>, Ricardo Palomares =?iso-8859-1?Q?Mart=EDnez?= 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