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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice