File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
pydatastructs/trees/tests Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -147,8 +147,25 @@ def test_cpp_BST2():
147
147
assert b3 .lower_bound (- 1 ) == 7
148
148
assert b3 .lower_bound (20 ) is None
149
149
150
- test_cpp_BST2 ()
150
+ # test_cpp_BST2()
151
151
152
+ def test_cpp_BST_speed ():
153
+ BST = BinarySearchTree
154
+ import time
155
+ b = BST ()
156
+ t1 = time .time ()
157
+ for node in range (- 1000 ,1000 ):
158
+ b .insert (node , node )
159
+ t2 = time .time ()
160
+ b2 = BST (backend = Backend .CPP )
161
+ t3 = time .time ()
162
+ for node in range (- 1000 ,1000 ):
163
+ b2 .insert (node , node )
164
+ t4 = time .time ()
165
+ print ("Time taken by Python backend: " ,t2 - t1 ,"s" )
166
+ print ("Time taken by C++ backend: " ,t4 - t3 ,"s" )
167
+
168
+ # test_cpp_BST_speed()
152
169
153
170
################### Python Tests below ###################
154
171
You can’t perform that action at this time.
0 commit comments