示例#1
0
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
示例#2
0
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
示例#3
0
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
示例#4
0
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