Modification of Intersection of sorted array
问题 I came across this problem - input - I am given two sorted arrays a1 and a2. I need to find the elements that are not present in the second array. I have two approaches 1) Hashtable - O(m+n) [use when second array is small] 2) Binary Search - O(m*logn) [use when second array is huge] Are there any other approaches with better time complexities? Thank You 回答1: Just iterate them in parallel. Here's a JavaScript example: var a1 = [1, 2, 3, 4, 5, 6, 7, 9]; var a2 = [0, 2, 4, 5, 8]; findNotPresent