Dec 18, 2008

Given two arrays of numbers, find if each of the two arrays have the same set of integers ? Suggest an algo which can run faster than NlogN without ex

Given two arrays of numbers, find if each of the two arrays have the same set of integers ? Suggest an algo which can run faster than NlogN without extra space?

use a hash function,
sum up all hash values in first array
sum up all hash values in second array
compare

like checksum problem...

No comments:

Post a Comment