CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: kprice

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    10,767

    Re: Find a common node in two Linked lists

    On further considering, I'm overcomplicated this problem significantly.

    Just calculate N and M as above, and then consider which one is larger. If M > N, then walk forward in A (M-N) nodes. If N...
  2. Replies
    5
    Views
    10,767

    Re: Find a common node in two Linked lists

    Actually, you can find the common node in O(n) time for singlely linked lists with fixed memory overhead using a little bit of linear algebra.

    Step 1: Walk A and count the number of nodes. You...
Results 1 to 2 of 2





Click Here to Expand Forum to Full Width

Featured