Intersection of n sets without using a hash table.
Anonymous
OK. Assuming the two sets are simple arrays of numbers, you can choose to organize them in-place (with no additional memory cost) into a heap. Then your code calls both heap to get the next number to print out the intersecting numbers. Heap costs you O(n log n).
Check out your Company Bowl for anonymous work chats.