diff --git a/CompileTimeTest.py b/CompileTimeTest.py index 5d6b5b6..39930f0 100755 --- a/CompileTimeTest.py +++ b/CompileTimeTest.py @@ -19,7 +19,7 @@ for line in fileinput.input(testFile): #replace SD() with a d.s. line = line.replace("SD()", "SD(True, " + str(dataStructures[i]) + ")") file.write(line) - + file.close() start_time = time.time() @@ -27,10 +27,9 @@ elapsedTime = time.time() - start_time dataStructureTimes.append(elapsedTime) -for i in range(len(dataStructures)): +for i in range(len(dataStructures)): print ("Time using %s: %s" % (dataStructures[i], dataStructureTimes[i])) - diff --git a/DS.py b/DS.py index 00c50b1..8024917 100644 --- a/DS.py +++ b/DS.py @@ -5,5 +5,5 @@ class DS: MIN_HEAP = 3 MAX_HEAP = 4 HASHTABLE = 5 - NUM_STRUCTURES = 7 + NUM_STRUCTURES = 5 diff --git a/DS.pyc b/DS.pyc new file mode 100644 index 0000000..9ff2859 Binary files /dev/null and b/DS.pyc differ diff --git a/arr.pyc b/arr.pyc new file mode 100644 index 0000000..f6067de Binary files /dev/null and b/arr.pyc differ diff --git a/bst.pyc b/bst.pyc new file mode 100644 index 0000000..09f04b9 Binary files /dev/null and b/bst.pyc differ diff --git a/btree.pyc b/btree.pyc new file mode 100644 index 0000000..d3d2a10 Binary files /dev/null and b/btree.pyc differ diff --git a/main.pyc b/main.pyc new file mode 100644 index 0000000..a668289 Binary files /dev/null and b/main.pyc differ diff --git a/maxheap.pyc b/maxheap.pyc new file mode 100644 index 0000000..5fe8b3b Binary files /dev/null and b/maxheap.pyc differ diff --git a/minheap.pyc b/minheap.pyc new file mode 100644 index 0000000..750e791 Binary files /dev/null and b/minheap.pyc differ diff --git a/sarr.pyc b/sarr.pyc new file mode 100644 index 0000000..f862a60 Binary files /dev/null and b/sarr.pyc differ diff --git a/test.py b/test.py index 4c8831f..059327b 100644 --- a/test.py +++ b/test.py @@ -11,7 +11,7 @@ def test(): s_data.len = 0 - for x in choice([x for x in itertools.permutations(range(10))]): + for x in choice([x for x in itertools.permutations(range(100))]): s_data.add(x) print(str(s_data.contains(3)) + " should be true") diff --git a/test_compile.py b/test_compile.py index ce7ff10..9926912 100644 --- a/test_compile.py +++ b/test_compile.py @@ -11,8 +11,11 @@ def test(): s_data.len = 0 - for x in choice([x for x in itertools.permutations(range(10))]): - s_data.add(x) + for c in range(10000): + for x in choice([x for x in itertools.permutations(range(5))]): + s_data.add(x) + + print "size = " + str(s_data.len) print(str(s_data.contains(3)) + " should be true") diff --git a/test_compile_0.py b/test_compile_0.py index 7d2a5c3..0ff37ae 100644 --- a/test_compile_0.py +++ b/test_compile_0.py @@ -11,8 +11,11 @@ def test(): s_data.len = 0 - for x in choice([x for x in itertools.permutations(range(10))]): - s_data.add(x) + for c in range(10000): + for x in choice([x for x in itertools.permutations(range(5))]): + s_data.add(x) + + print "size = " + str(s_data.len) print(str(s_data.contains(3)) + " should be true") diff --git a/test_compile_1.py b/test_compile_1.py index aad7a41..b9501cd 100644 --- a/test_compile_1.py +++ b/test_compile_1.py @@ -11,8 +11,11 @@ def test(): s_data.len = 0 - for x in choice([x for x in itertools.permutations(range(10))]): - s_data.add(x) + for c in range(10000): + for x in choice([x for x in itertools.permutations(range(5))]): + s_data.add(x) + + print "size = " + str(s_data.len) print(str(s_data.contains(3)) + " should be true") diff --git a/test_compile_2.py b/test_compile_2.py index f71b2c9..f67e501 100644 --- a/test_compile_2.py +++ b/test_compile_2.py @@ -11,8 +11,11 @@ def test(): s_data.len = 0 - for x in choice([x for x in itertools.permutations(range(10))]): - s_data.add(x) + for c in range(10000): + for x in choice([x for x in itertools.permutations(range(5))]): + s_data.add(x) + + print "size = " + str(s_data.len) print(str(s_data.contains(3)) + " should be true") diff --git a/test_compile_3.py b/test_compile_3.py index 4778ea7..4998300 100644 --- a/test_compile_3.py +++ b/test_compile_3.py @@ -11,8 +11,11 @@ def test(): s_data.len = 0 - for x in choice([x for x in itertools.permutations(range(10))]): - s_data.add(x) + for c in range(10000): + for x in choice([x for x in itertools.permutations(range(5))]): + s_data.add(x) + + print "size = " + str(s_data.len) print(str(s_data.contains(3)) + " should be true") diff --git a/test_compile_4.py b/test_compile_4.py index dd8887f..e567617 100644 --- a/test_compile_4.py +++ b/test_compile_4.py @@ -11,8 +11,11 @@ def test(): s_data.len = 0 - for x in choice([x for x in itertools.permutations(range(10))]): - s_data.add(x) + for c in range(10000): + for x in choice([x for x in itertools.permutations(range(5))]): + s_data.add(x) + + print "size = " + str(s_data.len) print(str(s_data.contains(3)) + " should be true") diff --git a/test_compile_5.py b/test_compile_5.py index c59e4a3..c16b44a 100644 --- a/test_compile_5.py +++ b/test_compile_5.py @@ -21,5 +21,5 @@ def test(): print(str(s_data.get(0)) + " should be 0") -s_data = SD(5, True) +s_data = SD(True, 5) test() diff --git a/test_compile_6.py b/test_compile_6.py index 4ca7ac5..ce84f0f 100644 --- a/test_compile_6.py +++ b/test_compile_6.py @@ -21,5 +21,5 @@ def test(): print(str(s_data.get(0)) + " should be 0") -s_data = SD(6, True) +s_data = SD(True, 6) test()