def find_nsmallest(n, arr1, arr2): # new version, faster because it does not need to sort everything arr = numpy.concatenate((arr1, arr2)) return numpy.partition(arr, n)[n]