Thread: another list question....

  1. #31
    Learner Axel's Avatar
    Join Date
    Aug 2005
    Posts
    335
    yes i understand now............

    Code:
    loc=temp->next->next; /* store B somewhere */
    
    temp->next->next=temp->next->next->next; /* A-C-NULL */
    
    
    loc->next=temp->next; /*we form a spliced list (loc)B->C->NULL*/
    
    temp->next=loc; /* here we simply just make A->next point to B which forms A->B->C->NULL */
    yes?

  2. #32
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    U wud have nailed this ages back if u had paid attention to what is being posted here..
    even now, U r almost there, BUT ,not there yet....

    for one last time , read on...

    Code:
     loc=temp->next->next; /* store B somewhere */  [ correct]
    
    temp->next->next=temp->next->next->next; /* A-C-NULL */   [ correct]
    
    
    loc->next=temp->next; /*we form a spliced list (loc)B->C->NULL*/   [ wrong !!]
    I have forgotten how many times I have written that
    BOTH "B->next" and "A->next" point to C

    Its not hard to imagine.. We just have two pointer pointing to one location..
    AND A is still there in ur list..


    go back to the prev page and look at the explanation for the same thing.


    Code:
    temp->next=loc; /* here we simply just make A->next point to B which forms A->B->C->NULL  */    [ correct]
    U have reached the end result correctly , but u must perfectly understand how..
    In the middle of difficulty, lies opportunity

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unknown memory leak with linked lists...
    By RaDeuX in forum C Programming
    Replies: 6
    Last Post: 12-07-2008, 04:09 AM
  2. Anyone good with linked list.....I am not....
    By chadsxe in forum C++ Programming
    Replies: 11
    Last Post: 11-10-2005, 02:48 PM
  3. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  4. Problem with linked list ADT and incomplete structure
    By prawntoast in forum C Programming
    Replies: 1
    Last Post: 04-30-2005, 01:29 AM