def InsertWorst(ValueT): timeAr = np.zeros(ValueT, dtype=float) for i in range(0, ValueT): Ar1 = makeRevArray(i) t = timeit.Timer(lambda: prg1.insertionSort(Ar1)) timeAr[i] = scipy.mean(t.repeat(repeat=3, number=1)) return timeAr
def InsertWorst(ValueT): timeAr = np.zeros(ValueT, dtype = float) for i in range(0, ValueT): Ar1 = makeRevArray(i) t = timeit.Timer(lambda: prg1.insertionSort(Ar1)) timeAr[i] = scipy.mean(t.repeat(repeat=3, number=1)) return timeAr
def getAverageInsertion(a): avgArray = np.zeros(10, dtype=float) for j in range(0, 10): np.random.seed(0) np.random.permutation(a) t = timeit.Timer(lambda: insertionSort(a)) avgArray[j] = scipy.mean(t.repeat(repeat=3, number=1)) average = np.average(avgArray) return average
def getAverageInsertion(a): avgArray = np.zeros(10, dtype=float) for j in range(0,10): np.random.seed(0) np.random.permutation(a) t = timeit.Timer(lambda: insertionSort(a)) avgArray[j] = scipy.mean(t.repeat(repeat=3,number=1)) average = np.average(avgArray) return average