1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help Needed!!!

Discussion in 'C' started by suprakashnandy, Sep 28, 2007.

  1. suprakashnandy

    suprakashnandy New Member

    Joined:
    Sep 28, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I want the solution of a linked list problem...The problem is :

    I have a infinitely long Singly linked list and don't have any start and end pointer. There is a pointer p, pointing to a node somewhere in the linked list and i have to delete its previous node. Is it possible and if yes then how?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    As its single list you cannot reach the previous node unless its a cyclic single linked list.
     
  3. An007kit

    An007kit New Member

    Joined:
    Oct 1, 2007
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Am a student
    Location:
    Live in chandigarh, india
    I am not sure what do ya mean by the fact infinitely long.....
    Otherwise ya can work on the lines of shabbir...
    check for a circular linked list....
    that can be done by initialising two pointers and incrementing them at different interval...one at an increment of 1 other at an increment of 2...
    if they meet....linked list is circular....
    then ya can go to the previous node or previous to previous node and complete ur stuff....
     

Share This Page