sort_merge_join function 
O(max(m,n)) to O(m+n)
See http://garysieling.com/blog/six-join-implementations-in-javascript