Nevermind . . . I figured it out.
Nevermind . . . I figured it out.
Last edited by tsut; 09-25-2003 at 10:05 PM.
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.
Thanks! I couldn't figure out the code and spent a lot of time trying to figure it out.
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