moving nodes between linked lists

This is a discussion on moving nodes between linked lists within the C Programming forums, part of the General Programming Boards category; How would one move a node from one list to the beginning of another? Could you point me to some ...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    74

    moving nodes between linked lists

    How would one move a node from one list to the beginning of another?

    Could you point me to some code?

    EDIT: I did it! And it is all thanks to this song http://www.youtube.com/watch?v=ehmFl1sjkXg

    My algorithm:

    1. get the predecessor of the node you wish to move (MoveNode)
    2. use the predecessor to switch the MoveNode with the head of the list
    3. move the MoveNode from the head of the original list to the beginning of the destination list
    4. delete the head of the original list

    Does anybody want code?
    Last edited by budala; 08-09-2009 at 09:32 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 06-16-2006, 09:23 PM
  2. Linked Lists 101
    By The Brain in forum C++ Programming
    Replies: 5
    Last Post: 07-24-2004, 04:32 PM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  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

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21