-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathplotter.py
More file actions
61 lines (49 loc) · 1.63 KB
/
plotter.py
File metadata and controls
61 lines (49 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import pandas as pd
import matplotlib.pyplot as plt
data = {
"Array Size": [10, 50, 100],
"Linear Hashing": [0.531, 1.834, 4.620],
"Quadratic Hashing": [0.110, 0.131, 0.247]
}
df = pd.DataFrame(data)
plt.figure(figsize=(10, 6))
plt.plot(df["Array Size"], df["Linear Hashing"], label="Linear Hashing", color="blue")
plt.plot(df["Array Size"], df["Quadratic Hashing"], label="Quadratic Hashing", color="green")
plt.title("Hashing Algorithms Performance")
plt.xlabel("Array Size")
plt.ylabel("Time (milliseconds)")
plt.grid(True)
plt.legend()
plt.show()
# Linear Hashing
plt.figure(figsize=(10, 6))
plt.plot(df["Array Size"], df["Linear Hashing"], label="Linear Hashing", color="blue")
plt.title("Linear Hashing")
plt.xlabel("Array Size")
plt.ylabel("Time (milliseconds)")
plt.grid(True)
plt.legend()
plt.show()
# Quadratic Hashing
plt.figure(figsize=(10, 6))
plt.plot(df["Array Size"], df["Quadratic Hashing"], label="Quadratic Hashing", color="green")
plt.title("Quadratic Hashing")
plt.xlabel("Array Size")
plt.ylabel("Time (milliseconds)")
plt.grid(True)
plt.legend()
plt.show()
fig, axs = plt.subplots(2, 1, figsize=(10, 10), gridspec_kw={'hspace': 0.4})
# Linear Hashing
axs[0].plot(df["Array Size"], df["Linear Hashing"], label="Linear Hashing", color="blue")
axs[0].set_title("Linear Hashing")
axs[0].set_xlabel("Array Size")
axs[0].set_ylabel("Time (milliseconds)")
axs[0].grid(True)
# Quadratic Hashing
axs[1].plot(df["Array Size"], df["Quadratic Hashing"], label="Quadratic Hashing", color="green")
axs[1].set_title("Quadratic Hashing")
axs[1].set_xlabel("Array Size")
axs[1].set_ylabel("Time (milliseconds)")
axs[1].grid(True)
plt.show()