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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a676349b69fa778f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-12 12:06:04 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!sunqbc.risq.qc.ca!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news1.frmt1.sfba.home.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Help: my list adt is broken References: X-Newsreader: Tom's custom newsreader Message-ID: Date: Mon, 12 Feb 2001 20:00:42 GMT NNTP-Posting-Host: 24.20.190.201 X-Complaints-To: abuse@home.net X-Trace: news1.frmt1.sfba.home.com 982008042 24.20.190.201 (Mon, 12 Feb 2001 12:00:42 PST) NNTP-Posting-Date: Mon, 12 Feb 2001 12:00:42 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: supernews.google.com comp.lang.ada:5188 Date: 2001-02-12T20:00:42+00:00 List-Id: 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".