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,ccd10064619f1aa,start X-Google-Attributes: gid103376,public From: byrner Subject: How: Remove end of Linked List w/ tail pointer? Date: 1997/11/30 Message-ID: <65s8gp$pdc@bgtnsc03.worldnet.att.net>#1/1 X-Deja-AN: 293935091 Organization: AT&T WorldNet Services Newsgroups: comp.lang.ada Date: 1997-11-30T00:00:00+00:00 List-Id: Does anybody know of a way to make the TAIL pointer point to the previous node in the linked list structure defined below without starting at the HEAD and performing a loop to search through the entire list? Essentially, what I need to do is remove the last node from the list, but before I do this, I will have to update the TAIL pointer so it points to the node which will be the tail of the list after I remove the last node (the next to last node) Is this even possible without searching the entire list? I am using Ada95. type LISTNODE; type LIST is access LISTNODE; type LISTNODE is record TIME: NATURAL; NEXT: LIST; end record; type LISTPOINTER is record DATA: NATURAL; HEAD: LIST; TAIL: LIST; SIZE: NATURAL; --number of nodes in linked list end record; NOTE: I am not actually going to delete the last node; I want to move it from the end of one linked list to the end of a second one. I plan to make the second list point to the end of the first list, and then remove the link from the first list to that last node. I do not want to search through the whole list because this operation will be performed with up to 8 lists until they are all as close as possible to being the same length. The entire procedure above will then be repeated up to 6000 times, so it would take a while to search through the list to find the next to last node in the list each time. Any ideas of how this can be done? Any help would be greatly appreciated! Thank you. byrner@db.erau.edu