We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6a7401d commit b6e9bb9Copy full SHA for b6e9bb9
1 file changed
Introduction to algorithms/Insertion_Sort.py
@@ -1,4 +1,4 @@
1
-import random
+import random, time
2
class InsertionSort(object):
3
def __init__(self, nums):
4
self.nums = nums
@@ -22,9 +22,9 @@ def sort(self):
22
return a
23
24
if __name__ == '__main__':
25
- x = [i for i in range(200)]
+ start = time.time()
26
+ x = [i for i in range(15000)]
27
random.shuffle(x)
- print(x)
28
- print('*'*20)
29
- s = InsertionSort(x)
30
- print(s.sort())
+ s = InsertionSort(x).sort()
+ end = time.time()
+ print(end - start)
0 commit comments