common_elements ::= empty list; while all lists are non-empty; do if the first elements of all the lists are the same add that element to common_elements else max_element ::= maximum first element of all lists foreach list; do if first element of list < max_element; shift it off the list endif done