Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

A question about connecting two circular lists

  1. Mar 18, 2008 #1
    i have two circular linkes and we need to connect them together
    in the place where we found some value in the node
    the implemintation is here:
    i can get the link where the X value
    and the previous to it

    but i also need to close links from the other list
    tare them and connect them together
    i cant see where its been done
    in this code
    ??
    Code (Text):

    public void insertBefore (Object x,Link link) {
    Link p= whereIs(x) ; //a given function that return the node that has X
    if (p!=null) {
    Link  q=link;
    while (q.next !=link)
      q=q.next;
    q.next=p.next;
    p.next=link;
    }
    }
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?
Draft saved Draft deleted



Similar Discussions: A question about connecting two circular lists
Loading...