Thread: Doubly Linked Lists

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    9

    Please Delete

    Nevermind . . . I figured it out.
    Last edited by tsut; 09-25-2003 at 10:05 PM.

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    596
    Before you do the InsertBefore, current -> prev -> next pointed to current.

    But now you're inserting something new (tempNode) before current, so you want to end up with the old current -> prev -> next pointing to tempNode, and tempNode -> next pointing to current, and current -> prev pointing to tempNode.

    In your numbers example, AFTER everything is done, if current is 9, current -> prev -> next is 9.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    9
    Thanks! I couldn't figure out the code and spent a lot of time trying to figure it out.

  4. #4
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355
    There is no point erasing your post after you get an answer, if you figure it out for yourself, you should say how, and leave it because one day someone else might get their answer instead of having to post.
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Doubly linked lists
    By mohanlon in forum C Programming
    Replies: 8
    Last Post: 12-08-2010, 01:01 AM
  2. Doubly Linked Lists
    By Swerve in forum C++ Programming
    Replies: 6
    Last Post: 03-23-2009, 12:51 PM
  3. Linked Lists 101
    By The Brain in forum C++ Programming
    Replies: 5
    Last Post: 07-24-2004, 04:32 PM
  4. need help w/ linked lists
    By MKashlev in forum C++ Programming
    Replies: 11
    Last Post: 08-05-2002, 08:57 PM
  5. doubly linked lists
    By qwertiop in forum C++ Programming
    Replies: 3
    Last Post: 10-03-2001, 06:25 PM