some execution time testings
This commit is contained in:
parent
cdac29dee7
commit
f700f0cb32
@ -3,24 +3,9 @@ from tools.trees import MinHeap, BinarySearchTree
|
||||
from tools.stopwatch import StopWatch
|
||||
|
||||
|
||||
b = BinarySearchTree()
|
||||
for x in range(16):
|
||||
b.add(x)
|
||||
b.print()
|
||||
print("---")
|
||||
b.remove(7)
|
||||
b.remove(6)
|
||||
b.remove(4)
|
||||
b.remove(5)
|
||||
b.print()
|
||||
|
||||
exit()
|
||||
|
||||
# timing below :'-(
|
||||
|
||||
s = StopWatch()
|
||||
h = []
|
||||
for x in range(10_000):
|
||||
for x in range(1_000_000):
|
||||
heappush(h, x)
|
||||
print("Heappush:", s.elapsed())
|
||||
while h:
|
||||
@ -29,7 +14,7 @@ print("Heappop:", s.elapsed())
|
||||
|
||||
s = StopWatch()
|
||||
h = MinHeap()
|
||||
for x in range(10_000):
|
||||
for x in range(1_000_000):
|
||||
h.add(x)
|
||||
print("MinHeap.add():", s.elapsed())
|
||||
while not h.empty():
|
||||
|
||||
Loading…
Reference in New Issue
Block a user