Skip to content

Commit 03c78af

Browse files
Add files via upload
1 parent 134a325 commit 03c78af

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Sorting-Searching-Algorithm-Tester.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,23 @@ def binary_search(arr, low, high):
8181
if __name__ == "__main__":
8282
array = []
8383

84-
itemWanted = 10
85-
length_of_list = 100000
84+
itemWanted = 10854 # Item you want to search for
85+
length_of_list = 10000000 # Amount of entries you want in your dataset
8686

87-
# fills an array with random numbers from range specified
87+
# Fills an array with random numbers from range specified
8888
for x in range(length_of_list):
8989
array.append(random.randint(0,length_of_list))
9090
start_time = time.time()
91-
# sorting algorithm
91+
92+
# Add Sorting Algo of choice
9293

9394
quick_sort(array,0,len(array)-1)
9495

9596
past_time=time.time() - start_time
9697

98+
9799
print("--- %s seconds to sort ---" % (time.time() - start_time))
98-
# searching algorithm
100+
# Add Searching Algo of choice
99101
binary_search(array,0,len(array)-1)
100102

101103
print("--- %s seconds to find ---" % ((time.time() - start_time) - past_time))

0 commit comments

Comments
 (0)