Find a common element within N arrays

Posted by kunjaan on Stack Overflow See other posts from Stack Overflow or by kunjaan
Published on 2010-05-28T22:51:54Z Indexed on 2010/05/28 23:02 UTC
Read the original article Hit count: 177

Filed under:

If I have N arrays, what is the best(Time complexity. Space is not important) way to find the common elements. You could just find 1 element and stop.

Edit: The elements are all Numbers.

Edit: These are unsorted. Please do not sort and scan.

This is not a homework problem. Somebody asked me this question a long time ago. He was using a hash to solve the problem. I was thinking if SO has solved similar problems.

© Stack Overflow or respective owner

Related posts about algorithm