title: Best algorithm to compare two lists in python
body: <p>I have two lists (list1 and list2) in python filled with an own datatype. 
  I want to compare these to lists and give all elements of these lists to stdout(or somewhere else), but in a specific order(without sorting the lists in any way). </p>
  
  <p>List1 and List2 can have elements which are not in the other list, but can also have elements which be in the other list. These elements, beeing in both lists, should output at the same line. But the elements beeing only in one list, should be in the right order too, at the end. </p>
  
  <p>Example:</p>
  
  <pre><code>List1 = [A,B,C,D,F,H,G];
  List2 = [A,C,D,E,H];
  
  output should be:
  
  List1 |List2
    A      A
    B      
    C      C
    D      D
           E
    F
    H      H
    G
  </code></pre>
  
  <p>How can I "sort" in these way?</p>