Esempio n. 1
0
        elif array[x] > key:
            end = x - 1

        elif array[x] < key:
            start = x + 1

    return -1



if __name__ == '__main__':
    m = Manipulate()

    with open('../data.txt', 'r') as textFile:
        objects = [m.countVowels(i.strip()) for i in textFile.readlines()]

    key = random.randint(0,8)

    t1 = time.perf_counter()

    # Will take average of ~ 0.014 seconds if minimum system requirements are met
    print(binary_search(sorted(objects),key))

    t2 = time.perf_counter()
    print(f"Binary Search finished in {t2 - t1} seconds. Array size: {len(objects)}")


    #Testing to get average time

    '''