comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: Help: my list adt is broken
Date: Mon, 12 Feb 2001 14:55:18 GMT
Date: 2001-02-12T14:55:18+00:00	[thread overview]
Message-ID: <968tgh$358$1@nnrp1.deja.com> (raw)
In-Reply-To: 5aDh6.11952$BQ3.215984@news6-win.server.ntlworld.com

In article <5aDh6.11952$BQ3.215984@news6-win.server.ntlworld.com>,
  "chris.danx" <chris.danx@ntlworld.com> wrote:

> i seem to have a problem with my (doubly) linked list ADT, and i can't
> figure out what's wrong.
...
> i think the problem occurs when removing the tail.  it doesn't seem to
>  be erased but it should be.  i know
> it's removed one from the size variable, so the code should be
> executed in full.

I don't see anything obviously wrong in the routine you posted, but its
tough to tell since there's no indication as to what the types you are
using are, or how the fundamental algorithms you are using are written.
If I had to take a wild guess, I'd say that your logic for setting up
the ".prev" links is bad, since that could cause what you are seeing,
and the stuff that *is* working doesn't seem to use those .prev links
(but again, that isn't shown here).

One debugging trick I often find useful for data structures is to get
out a pencil and a piece of paper (or a whiteboard) and run through the
source code like I'm the computer. Data elements can be represented as
boxes, and link fields can be represented by drawing arrows between the
boxes.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com
http://www.deja.com/



  parent reply	other threads:[~2001-02-12 14:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-11 21:05 Help: my list adt is broken chris.danx
2001-02-11 21:08 ` chris.danx
2001-02-12 14:55 ` Ted Dennison [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-02-13 15:35 schwarza
2001-02-14 11:47 ` John English
2001-02-12 21:14 schwarza
2001-02-12 23:09 ` chris.danx
2001-02-13  1:42   ` Jeffrey Carter
2001-02-11 21:04 chris.danx
2001-02-11 23:01 ` Larry Hazel
2001-02-12  0:29 ` tmoran
2001-02-12  0:29 ` Chad R. Meiners
2001-02-12 12:17 ` chris.danx
2001-02-12 12:50 ` chris.danx
2001-02-12 14:23   ` John English
2001-02-12 15:10     ` chris.danx
2001-02-12 17:33 ` chris.danx
2001-02-12 20:00   ` tmoran
replies disabled

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