comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Help: my list adt is broken
Date: Mon, 12 Feb 2001 20:00:42 GMT
Date: 2001-02-12T20:00:42+00:00	[thread overview]
Message-ID: <KhXh6.86727$R5.3947818@news1.frmt1.sfba.home.com> (raw)
In-Reply-To: v7Vh6.14798$zz4.349115@news2-win.server.ntlworld.com

Just approach the problem one step at a time.  An arbitrary node has
how many incoming and outgoing pointer fields?  You have two nodes to
move, so write down assignment statements to change all the pointers.
If a node is a head node, its prev is null, which means its actual
prev is "head".  So any assignment that uses x.prev.all needs an "if"
to check that x.prev is not null, and, if it is null, use "head"
instead.  Similarly for a tail node.  Now make sure that in the
assignment statements you haven't tried to use something's old value
after changing it, eg "x.next := something_new;" followed by using
x.next as if it still had something_old as its value.  If so, make a
temporary copy of something_old before destroying it with "x.next :=
something_new".



  reply	other threads:[~2001-02-12 20:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-11 21:04 Help: my list adt is broken 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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-02-11 21:05 chris.danx
2001-02-11 21:08 ` chris.danx
2001-02-12 14:55 ` Ted Dennison
2001-02-12 21:14 schwarza
2001-02-12 23:09 ` chris.danx
2001-02-13  1:42   ` Jeffrey Carter
2001-02-13 15:35 schwarza
2001-02-14 11:47 ` John English
replies disabled

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