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

Regarding Linked Lists

Discussion in 'C' started by vskumar19, Sep 8, 2010.

  1. vskumar19

    vskumar19 New Member

    Joined:
    Sep 8, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Consider a single linked list with 'n' nodes and other single linked list with 'm' nodes
    At the 'k'th node in 'n' ,the second linked list merges at some part of it .. jst like the shape Y

    Now i was asked to find out the address of Kth node

    I did it by taking the address of the each node in an array and compared with the address of the 2nd linked list with a time complexity of O(n*m)

    But i was asked to reduce the time complexity .. even assuming that 'n' and 'm' are equal

    Is there any possible method to reduce the time complexity other than O(n*n) ??
     

Share This Page