Merge pull request '[1]task1' (#201) from romanovpv/2026-rff_mp:task1 into develop
Reviewed-on: #201
This commit is contained in:
commit
5c7b6b0ac1
61
romanovpv/task 1/docs/data/bst.py
Normal file
61
romanovpv/task 1/docs/data/bst.py
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
def bst_create_node(name, phone):
|
||||
return {'name': name, 'phone': phone, 'left': None, 'right': None}
|
||||
|
||||
def bst_insert(root, name, phone):
|
||||
if root is None:
|
||||
return bst_create_node(name, phone)
|
||||
|
||||
if name == root['name']:
|
||||
root['phone'] = phone
|
||||
elif name < root['name']:
|
||||
root['left'] = bst_insert(root['left'], name, phone)
|
||||
else:
|
||||
root['right'] = bst_insert(root['right'], name, phone)
|
||||
return root
|
||||
|
||||
def bst_find(root, name):
|
||||
if root is None:
|
||||
return None
|
||||
if root['name'] == name:
|
||||
return root['phone']
|
||||
if name < root['name']:
|
||||
return bst_find(root['left'], name)
|
||||
return bst_find(root['right'], name)
|
||||
|
||||
def _bst_min_value_node(node):
|
||||
current = node
|
||||
while current['left'] is not None:
|
||||
current = current['left']
|
||||
return current
|
||||
|
||||
def bst_delete(root, name):
|
||||
if root is None:
|
||||
return None
|
||||
|
||||
if name < root['name']:
|
||||
root['left'] = bst_delete(root['left'], name)
|
||||
elif name > root['name']:
|
||||
root['right'] = bst_delete(root['right'], name)
|
||||
else:
|
||||
|
||||
if root['left'] is None:
|
||||
return root['right']
|
||||
elif root['right'] is None:
|
||||
return root['left']
|
||||
|
||||
temp = _bst_min_value_node(root['right'])
|
||||
root['name'] = temp['name']
|
||||
root['phone'] = temp['phone']
|
||||
root['right'] = bst_delete(root['right'], temp['name'])
|
||||
|
||||
return root
|
||||
|
||||
def bst_list_all(root):
|
||||
def inorder(node, acc):
|
||||
if node:
|
||||
inorder(node['left'], acc)
|
||||
acc.append((node['name'], node['phone']))
|
||||
inorder(node['right'], acc)
|
||||
return acc
|
||||
|
||||
return inorder(root, [])
|
||||
101
romanovpv/task 1/docs/data/graphs.py
Normal file
101
romanovpv/task 1/docs/data/graphs.py
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
plt.figure(figsize=(6, 5))
|
||||
plt.bar(
|
||||
["Sorted", "Random"],
|
||||
[8.083650, 5.302733]
|
||||
)
|
||||
plt.title("LinkedList — Insert")
|
||||
plt.ylabel("Time (sec)")
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
plt.figure(figsize=(6, 5))
|
||||
plt.bar(
|
||||
["Sorted", "Random"],
|
||||
[0.071586, 0.079588]
|
||||
)
|
||||
plt.title("LinkedList — Search")
|
||||
plt.ylabel("Time (sec)")
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
plt.figure(figsize=(6, 5))
|
||||
plt.bar(
|
||||
["Sorted", "Random"],
|
||||
[0.042504, 0.052027]
|
||||
)
|
||||
plt.title("LinkedList — Delete")
|
||||
plt.ylabel("Time (sec)")
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
plt.figure(figsize=(6, 5))
|
||||
plt.bar(
|
||||
["Sorted", "Random"],
|
||||
[0.101125, 0.121933]
|
||||
)
|
||||
plt.title("HashTable — Insert")
|
||||
plt.ylabel("Time (sec)")
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
plt.figure(figsize=(6, 5))
|
||||
plt.bar(
|
||||
["Sorted", "Random"],
|
||||
[0.000974, 0.000976]
|
||||
)
|
||||
plt.title("HashTable — Search")
|
||||
plt.ylabel("Time (sec)")
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
plt.figure(figsize=(6, 5))
|
||||
plt.bar(
|
||||
["Sorted", "Random"],
|
||||
[0.000567, 0.000591]
|
||||
)
|
||||
plt.title("HashTable — Delete")
|
||||
plt.ylabel("Time (sec)")
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
plt.figure(figsize=(6, 5))
|
||||
plt.bar(
|
||||
["Sorted", "Random"],
|
||||
[14.745275, 0.205333]
|
||||
)
|
||||
|
||||
plt.title("BST — Insert")
|
||||
plt.ylabel("Time (sec)")
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
plt.figure(figsize=(6, 5))
|
||||
plt.bar(
|
||||
["Sorted", "Random"],
|
||||
[0.149163, 0.000375]
|
||||
)
|
||||
|
||||
plt.title("BST — Search")
|
||||
plt.ylabel("Time (sec)")
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
plt.figure(figsize=(6, 5))
|
||||
plt.bar(
|
||||
["Sorted", "Random"],
|
||||
[0.302392, 0.002267]
|
||||
)
|
||||
plt.title("BST — Delete")
|
||||
plt.ylabel("Time (sec)")
|
||||
plt.show()
|
||||
29
romanovpv/task 1/docs/data/hash_table.py
Normal file
29
romanovpv/task 1/docs/data/hash_table.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import linked_list as ll
|
||||
|
||||
def ht_create(size=100):
|
||||
return [None] * size
|
||||
|
||||
def ht_get_hash(buckets, name):
|
||||
return hash(name) % len(buckets)
|
||||
|
||||
def ht_insert(buckets, name, phone):
|
||||
idx = ht_get_hash(buckets, name)
|
||||
buckets[idx] = ll.ll_insert(buckets[idx], name, phone)
|
||||
|
||||
def ht_find(buckets, name):
|
||||
idx = ht_get_hash(buckets, name)
|
||||
return ll.ll_find(buckets[idx], name)
|
||||
|
||||
def ht_delete(buckets, name):
|
||||
idx = ht_get_hash(buckets, name)
|
||||
buckets[idx] = ll.ll_delete(buckets[idx], name)
|
||||
|
||||
def ht_list_all(buckets):
|
||||
all_entries = []
|
||||
for bucket in buckets:
|
||||
if bucket:
|
||||
current = bucket
|
||||
while current:
|
||||
all_entries.append((current['name'], current['phone']))
|
||||
current = current['next']
|
||||
return sorted(all_entries, key=lambda x: x[0])
|
||||
47
romanovpv/task 1/docs/data/linked_list.py
Normal file
47
romanovpv/task 1/docs/data/linked_list.py
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
def ll_create_node(name, phone):
|
||||
return {'name': name, 'phone': phone, 'next': None}
|
||||
|
||||
def ll_insert(head, name, phone):
|
||||
if head is None:
|
||||
return ll_create_node(name, phone)
|
||||
current = head
|
||||
while current:
|
||||
if current ['name'] == name:
|
||||
current['phone'] = phone
|
||||
return head
|
||||
if current ['next'] is None:
|
||||
break
|
||||
current = current['next']
|
||||
current['next'] = ll_create_node(name, phone)
|
||||
return head
|
||||
|
||||
def ll_find(head, name):
|
||||
current = head
|
||||
while current:
|
||||
if current['name'] == name:
|
||||
return current['phone']
|
||||
current = current['next']
|
||||
return None
|
||||
|
||||
def ll_delete(head, name):
|
||||
if head is None:
|
||||
return None
|
||||
if head['name'] == name:
|
||||
return head['next']
|
||||
|
||||
current = head
|
||||
while current['next']:
|
||||
if current['next']['name'] == name:
|
||||
current['next'] = current['next']['next']
|
||||
return head
|
||||
|
||||
current = current['next']
|
||||
return head
|
||||
|
||||
def ll_list_all(head):
|
||||
items = []
|
||||
current = head
|
||||
while current:
|
||||
items.append((current['name'], current['phone']))
|
||||
current = current['next']
|
||||
return sorted(items, key=lambda x:x[0])
|
||||
205
romanovpv/task 1/docs/data/main.py
Normal file
205
romanovpv/task 1/docs/data/main.py
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
import time
|
||||
import random
|
||||
import linked_list as ll
|
||||
import hash_table as ht
|
||||
import bst
|
||||
import sys
|
||||
|
||||
sys.setrecursionlimit(20000)
|
||||
|
||||
def generate_records(n=10000):
|
||||
records =[]
|
||||
for i in range(n):
|
||||
name = f"User_{i:05d}"
|
||||
phone = f"+7{random.randint(9000000000, 9999999999)}"
|
||||
records.append((name, phone))
|
||||
|
||||
records_sorted = list(records)
|
||||
records_shuffled = list(records)
|
||||
random.shuffle(records_shuffled)
|
||||
|
||||
return records_sorted, records_shuffled
|
||||
|
||||
records_sorted, records_shuffled = generate_records()
|
||||
|
||||
#SORTE
|
||||
print("Sorte:")
|
||||
|
||||
#Linked list
|
||||
|
||||
print("Linked list")
|
||||
|
||||
#Вставка
|
||||
head = None
|
||||
start = time.perf_counter()
|
||||
for name, phone in records_sorted:
|
||||
head = ll.ll_insert(head, name, phone)
|
||||
end = time.perf_counter()
|
||||
print(f"Insert: {end - start:.4f} sec")
|
||||
|
||||
#Поиск
|
||||
existing = random.sample(records_sorted, 100)
|
||||
missing = [f"None_{i}" for i in range(10)]
|
||||
start = time.perf_counter()
|
||||
for name, _ in existing:
|
||||
ll.ll_find(head, name)
|
||||
for name in missing:
|
||||
ll.ll_find(head, name)
|
||||
end = time.perf_counter()
|
||||
print(f"Find (110): {end - start:.6f} sec")
|
||||
|
||||
#Удаление
|
||||
to_delete = random.sample(records_sorted, 50)
|
||||
|
||||
start = time.perf_counter()
|
||||
for name, _ in to_delete:
|
||||
head = ll.ll_delete(head, name)
|
||||
end = time.perf_counter()
|
||||
print(f"Delete (50): {end - start:.6f} sec")
|
||||
|
||||
#Hash table
|
||||
|
||||
print("Hash table")
|
||||
|
||||
#Вставка
|
||||
table = ht.ht_create()
|
||||
start = time.perf_counter()
|
||||
for name, phone in records_sorted:
|
||||
ht.ht_insert(table, name, phone)
|
||||
end = time.perf_counter()
|
||||
print(f"Insert: {end - start:.4f} sec")
|
||||
|
||||
#Поиск
|
||||
start = time.perf_counter()
|
||||
for name, _ in existing:
|
||||
ht.ht_find(table, name)
|
||||
for name in missing:
|
||||
ht.ht_find(table, name)
|
||||
end = time.perf_counter()
|
||||
print(f"Find (110): {end - start:.6f} sec")
|
||||
|
||||
#УДаление
|
||||
start = time.perf_counter()
|
||||
for name, _ in to_delete:
|
||||
ht.ht_delete(table, name)
|
||||
end = time.perf_counter()
|
||||
print(f"Delete (50): {end - start:.6f} sec")
|
||||
|
||||
#BST
|
||||
|
||||
print("BST")
|
||||
|
||||
#Вставка
|
||||
root = None
|
||||
start = time.perf_counter()
|
||||
for name, phone in records_sorted:
|
||||
root = bst.bst_insert(root, name, phone)
|
||||
end = time.perf_counter()
|
||||
print(f"Insert: {end - start:.4f} sec")
|
||||
|
||||
#Поиск
|
||||
start = time.perf_counter()
|
||||
for name, _ in existing:
|
||||
bst.bst_find(root, name)
|
||||
for name in missing:
|
||||
bst.bst_find(root, name)
|
||||
end = time.perf_counter()
|
||||
print(f"Find (110): {end - start:.6f} sec")
|
||||
|
||||
#Удаление
|
||||
start = time.perf_counter()
|
||||
for name, _ in to_delete:
|
||||
root = bst.bst_delete(root, name)
|
||||
end = time.perf_counter()
|
||||
print(f"Delete (50): {end - start:.6f} sec")
|
||||
|
||||
#SHUFFLE
|
||||
print("Shuffle:")
|
||||
|
||||
#Linked list
|
||||
|
||||
print("Linked list")
|
||||
|
||||
#Вставка
|
||||
head = None
|
||||
start = time.perf_counter()
|
||||
for name, phone in records_shuffled:
|
||||
head = ll.ll_insert(head, name, phone)
|
||||
end = time.perf_counter()
|
||||
print(f"Insert: {end - start:.4f} sec")
|
||||
|
||||
#Поиск
|
||||
existing = random.sample(records_shuffled, 100)
|
||||
missing = [f"None_{i}" for i in range(10)]
|
||||
start = time.perf_counter()
|
||||
for name, _ in existing:
|
||||
ll.ll_find(head, name)
|
||||
for name in missing:
|
||||
ll.ll_find(head, name)
|
||||
end = time.perf_counter()
|
||||
print(f"Find (110): {end - start:.6f} sec")
|
||||
|
||||
#Удаление
|
||||
to_delete = random.sample(records_shuffled, 50)
|
||||
|
||||
start = time.perf_counter()
|
||||
for name, _ in to_delete:
|
||||
head = ll.ll_delete(head, name)
|
||||
end = time.perf_counter()
|
||||
print(f"Delete (50): {end - start:.6f} sec")
|
||||
|
||||
#Hash table
|
||||
|
||||
print("Hash table")
|
||||
|
||||
#Вставка
|
||||
table = ht.ht_create()
|
||||
start = time.perf_counter()
|
||||
for name, phone in records_shuffled:
|
||||
ht.ht_insert(table, name, phone)
|
||||
end = time.perf_counter()
|
||||
print(f"Insert: {end - start:.4f} sec")
|
||||
|
||||
#Поиск
|
||||
start = time.perf_counter()
|
||||
for name, _ in existing:
|
||||
ht.ht_find(table, name)
|
||||
for name in missing:
|
||||
ht.ht_find(table, name)
|
||||
end = time.perf_counter()
|
||||
print(f"Find (110): {end - start:.6f} sec")
|
||||
|
||||
#УДаление
|
||||
start = time.perf_counter()
|
||||
for name, _ in to_delete:
|
||||
ht.ht_delete(table, name)
|
||||
end = time.perf_counter()
|
||||
print(f"Delete (50): {end - start:.6f} sec")
|
||||
|
||||
#BST
|
||||
|
||||
print("BST")
|
||||
|
||||
#Вставка
|
||||
root = None
|
||||
start = time.perf_counter()
|
||||
for name, phone in records_shuffled:
|
||||
root = bst.bst_insert(root, name, phone)
|
||||
end = time.perf_counter()
|
||||
print(f"Insert: {end - start:.4f} sec")
|
||||
|
||||
#Поиск
|
||||
start = time.perf_counter()
|
||||
for name, _ in existing:
|
||||
bst.bst_find(root, name)
|
||||
for name in missing:
|
||||
bst.bst_find(root, name)
|
||||
end = time.perf_counter()
|
||||
print(f"Find (110): {end - start:.6f} sec")
|
||||
|
||||
#Удаление
|
||||
start = time.perf_counter()
|
||||
for name, _ in to_delete:
|
||||
root = bst.bst_delete(root, name)
|
||||
end = time.perf_counter()
|
||||
print(f"Delete (50): {end - start:.6f} sec")
|
||||
109
romanovpv/task 1/docs/data/results.csv
Normal file
109
romanovpv/task 1/docs/data/results.csv
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
Run,Structure,Mode,Operation,Time(sec)
|
||||
1,LinkedList,Sorted,Insert,8.1964
|
||||
1,LinkedList,Sorted,Search,0.057671
|
||||
1,LinkedList,Sorted,Delete,0.035085
|
||||
1,HashTable,Sorted,Insert,0.0894
|
||||
1,HashTable,Sorted,Search,0.000865
|
||||
1,HashTable,Sorted,Delete,0.000470
|
||||
1,BST,Sorted,Insert,14.9662
|
||||
1,BST,Sorted,Search,0.118534
|
||||
1,BST,Sorted,Delete,0.72515
|
||||
1,LinkedList,Random,Insert,7.2082
|
||||
1,LinkedList,Random,Search,0.076737
|
||||
1,LinkedList,Random,Delete,0.056586
|
||||
1,HashTable,Random,Insert,0.1015
|
||||
1,HashTable,Random,Search,0.000963
|
||||
1,HashTable,Random,Delete,0.000602
|
||||
1,BST,Random,Insert,0.506
|
||||
1,BST,Random,Search,0.000429
|
||||
1,BST,Random,Delete,0.00238
|
||||
2,LinkedList,Sorted,Insert,7.7138
|
||||
2,LinkedList,Sorted,Search,0.116941
|
||||
2,LinkedList,Sorted,Delete,0.060090
|
||||
2,HashTable,Sorted,Insert,0.1367
|
||||
2,HashTable,Sorted,Search,0.001365
|
||||
2,HashTable,Sorted,Delete,0.000725
|
||||
2,BST,Sorted,Insert,14.8739
|
||||
2,BST,Sorted,Search,0.125425
|
||||
2,BST,Sorted,Delete,0.076719
|
||||
2,LinkedList,Random,Insert,8.2494
|
||||
2,LinkedList,Random,Search,0.059883
|
||||
2,LinkedList,Random,Delete,0.041534
|
||||
2,HashTable,Random,Insert,0.1364
|
||||
2,HashTable,Random,Search,0.001197
|
||||
2,HashTable,Random,Delete,0.000688
|
||||
2,BST,Random,Insert,0.0633
|
||||
2,BST,Random,Search,0.000364
|
||||
2,BST,Random,Delete,0.00225
|
||||
3,LinkedList,Sorted,Insert,8.8046
|
||||
3,LinkedList,Sorted,Search,0.057129
|
||||
3,LinkedList,Sorted,Delete,0.038862
|
||||
3,HashTable,Sorted,Insert,0.0898
|
||||
3,HashTable,Sorted,Search,0.000828
|
||||
3,HashTable,Sorted,Delete,0.000556
|
||||
3,BST,Sorted,Insert,14.8563
|
||||
3,BST,Sorted,Search,0.203530
|
||||
3,BST,Sorted,Delete,0.105306
|
||||
3,LinkedList,Random,Insert,0.4506
|
||||
3,LinkedList,Random,Search,0.102144
|
||||
3,LinkedList,Random,Delete,0.057962
|
||||
3,HashTable,Random,Insert,0.1279
|
||||
3,HashTable,Random,Search,0.000767
|
||||
3,HashTable,Random,Delete,0.000484
|
||||
3,BST,Random,Insert,0.0467
|
||||
3,BST,Random,Search,0.000332
|
||||
3,BST,Random,Delete,0.00217
|
||||
4,LinkedList,Sorted,Insert,7.6198
|
||||
4,LinkedList,Sorted,Search,0.054603
|
||||
4,LinkedList,Sorted,Delete,0.035980
|
||||
4,HashTable,Sorted,Insert,0.0886
|
||||
4,HashTable,Sorted,Search,0.000837
|
||||
4,HashTable,Sorted,Delete,0.000515
|
||||
4,BST,Sorted,Insert,14.2847
|
||||
4,BST,Sorted,Search,0.112083
|
||||
4,BST,Sorted,Delete,0.76102
|
||||
4,LinkedList,Random,Insert,7.9882
|
||||
4,LinkedList,Random,Search,0.080089
|
||||
4,LinkedList,Random,Delete,0.045272
|
||||
4,HashTable,Random,Insert,0.1034
|
||||
4,HashTable,Random,Search,0.000897
|
||||
4,HashTable,Random,Delete,0.000522
|
||||
4,BST,Random,Insert,0.0415
|
||||
4,BST,Random,Search,0.000340
|
||||
4,BST,Random,Delete,0.00203
|
||||
5,LinkedList,Sorted,Insert,6.6408
|
||||
5,LinkedList,Sorted,Search,0.103166
|
||||
5,LinkedList,Sorted,Delete,0.044656
|
||||
5,HashTable,Sorted,Insert,0.0895
|
||||
5,HashTable,Sorted,Search,0.000782
|
||||
5,HashTable,Sorted,Delete,0.000464
|
||||
5,BST,Sorted,Insert,13.9106
|
||||
5,BST,Sorted,Search,0.113157
|
||||
5,BST,Sorted,Delete,0.073544
|
||||
5,LinkedList,Random,Insert,9.6219
|
||||
5,LinkedList,Random,Search,0.058146
|
||||
5,LinkedList,Random,Delete,0.036343
|
||||
5,HashTable,Random,Insert,0.0876
|
||||
5,HashTable,Random,Search,0.000840
|
||||
5,HashTable,Random,Delete,0.000460
|
||||
5,BST,Random,Insert,0.0406
|
||||
5,BST,Random,Search,0.000352
|
||||
5,BST,Random,Delete,0.00207
|
||||
Average,LinkedList,Sorted,Insert,8.083650
|
||||
Average,LinkedList,Sorted,Search,0.071586
|
||||
Average,LinkedList,Sorted,Delete,0.042504
|
||||
Average,HashTable,Sorted,Insert,0.101125
|
||||
Average,HashTable,Sorted,Search,0.000974
|
||||
Average,HashTable,Sorted,Delete,0.000567
|
||||
Average,BST,Sorted,Insert,14.745275
|
||||
Average,BST,Sorted,Search,0.149163
|
||||
Average,BST,Sorted,Delete,0.302392
|
||||
Average,LinkedList,Random,Insert,5.302733
|
||||
Average,LinkedList,Random,Search,0.079588
|
||||
Average,LinkedList,Random,Delete,0.052027
|
||||
Average,HashTable,Random,Insert,0.121933
|
||||
Average,HashTable,Random,Search,0.000976
|
||||
Average,HashTable,Random,Delete,0.000591
|
||||
Average,BST,Random,Insert,0.205333
|
||||
Average,BST,Random,Search,0.000375
|
||||
Average,BST,Random,Delete,0.002267
|
||||
|
152
romanovpv/task 1/docs/data/results.py
Normal file
152
romanovpv/task 1/docs/data/results.py
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
import csv
|
||||
|
||||
results = [
|
||||
["Run", "Structure", "Mode", "Operation", "Time(sec)"],
|
||||
|
||||
["1", "LinkedList", "Sorted", "Insert", "8.1964"],
|
||||
["1", "LinkedList", "Sorted", "Search", "0.057671"],
|
||||
["1", "LinkedList", "Sorted", "Delete", "0.035085"]
|
||||
,
|
||||
["1", "HashTable", "Sorted", "Insert", "0.0894"],
|
||||
["1", "HashTable", "Sorted", "Search", "0.000865"],
|
||||
["1", "HashTable", "Sorted", "Delete", "0.000470"],
|
||||
|
||||
["1", "BST", "Sorted", "Insert", "14.9662"],
|
||||
["1", "BST", "Sorted", "Search", "0.118534"],
|
||||
["1", "BST", "Sorted", "Delete", "0.72515"],
|
||||
|
||||
["1", "LinkedList", "Random", "Insert", "7.2082"],
|
||||
["1", "LinkedList", "Random", "Search", "0.076737"],
|
||||
["1", "LinkedList", "Random", "Delete", "0.056586"],
|
||||
|
||||
["1", "HashTable", "Random", "Insert", "0.1015"],
|
||||
["1", "HashTable", "Random", "Search", "0.000963"],
|
||||
["1", "HashTable", "Random", "Delete", "0.000602"],
|
||||
|
||||
["1", "BST", "Random", "Insert", "0.506"],
|
||||
["1", "BST", "Random", "Search", "0.000429"],
|
||||
["1", "BST", "Random", "Delete", "0.00238"],
|
||||
|
||||
["2", "LinkedList", "Sorted", "Insert", "7.7138"],
|
||||
["2", "LinkedList", "Sorted", "Search", "0.116941"],
|
||||
["2", "LinkedList", "Sorted", "Delete", "0.060090"],
|
||||
|
||||
["2", "HashTable", "Sorted", "Insert", "0.1367"],
|
||||
["2", "HashTable", "Sorted", "Search", "0.001365"],
|
||||
["2", "HashTable", "Sorted", "Delete", "0.000725"],
|
||||
|
||||
["2", "BST", "Sorted", "Insert", "14.8739"],
|
||||
["2", "BST", "Sorted", "Search", "0.125425"],
|
||||
["2", "BST", "Sorted", "Delete", "0.076719"],
|
||||
|
||||
["2", "LinkedList", "Random", "Insert", "8.2494"],
|
||||
["2", "LinkedList", "Random", "Search", "0.059883"],
|
||||
["2", "LinkedList", "Random", "Delete", "0.041534"],
|
||||
|
||||
["2", "HashTable", "Random", "Insert", "0.1364"],
|
||||
["2", "HashTable", "Random", "Search", "0.001197"],
|
||||
["2", "HashTable", "Random", "Delete", "0.000688"],
|
||||
|
||||
["2", "BST", "Random", "Insert", "0.0633"],
|
||||
["2", "BST", "Random", "Search", "0.000364"],
|
||||
["2", "BST", "Random", "Delete", "0.00225"],
|
||||
|
||||
["3", "LinkedList", "Sorted", "Insert", "8.8046"],
|
||||
["3", "LinkedList", "Sorted", "Search", "0.057129"],
|
||||
["3", "LinkedList", "Sorted", "Delete", "0.038862"],
|
||||
|
||||
["3", "HashTable", "Sorted", "Insert", "0.0898"],
|
||||
["3", "HashTable", "Sorted", "Search", "0.000828"],
|
||||
["3", "HashTable", "Sorted", "Delete", "0.000556"],
|
||||
|
||||
["3", "BST", "Sorted", "Insert", "14.8563"],
|
||||
["3", "BST", "Sorted", "Search", "0.203530"],
|
||||
["3", "BST", "Sorted", "Delete", "0.105306"],
|
||||
|
||||
["3", "LinkedList", "Random", "Insert", "0.4506"],
|
||||
["3", "LinkedList", "Random", "Search", "0.102144"],
|
||||
["3", "LinkedList", "Random", "Delete", "0.057962"],
|
||||
|
||||
["3", "HashTable", "Random", "Insert", "0.1279"],
|
||||
["3", "HashTable", "Random", "Search", "0.000767"],
|
||||
["3", "HashTable", "Random", "Delete", "0.000484"],
|
||||
|
||||
["3", "BST", "Random", "Insert", "0.0467"],
|
||||
["3", "BST", "Random", "Search", "0.000332"],
|
||||
["3", "BST", "Random", "Delete", "0.00217"],
|
||||
|
||||
["4", "LinkedList", "Sorted", "Insert", "7.6198"],
|
||||
["4", "LinkedList", "Sorted", "Search", "0.054603"],
|
||||
["4", "LinkedList", "Sorted", "Delete", "0.035980"],
|
||||
|
||||
["4", "HashTable", "Sorted", "Insert", "0.0886"],
|
||||
["4", "HashTable", "Sorted", "Search", "0.000837"],
|
||||
["4", "HashTable", "Sorted", "Delete", "0.000515"],
|
||||
|
||||
["4", "BST", "Sorted", "Insert", "14.2847"],
|
||||
["4", "BST", "Sorted", "Search", "0.112083"],
|
||||
["4", "BST", "Sorted", "Delete", "0.76102"],
|
||||
|
||||
["4", "LinkedList", "Random", "Insert", "7.9882"],
|
||||
["4", "LinkedList", "Random", "Search", "0.080089"],
|
||||
["4", "LinkedList", "Random", "Delete", "0.045272"],
|
||||
|
||||
["4", "HashTable", "Random", "Insert", "0.1034"],
|
||||
["4", "HashTable", "Random", "Search", "0.000897"],
|
||||
["4", "HashTable", "Random", "Delete", "0.000522"],
|
||||
|
||||
["4", "BST", "Random", "Insert", "0.0415"],
|
||||
["4", "BST", "Random", "Search", "0.000340"],
|
||||
["4", "BST", "Random", "Delete", "0.00203"],
|
||||
|
||||
["5", "LinkedList", "Sorted", "Insert", "6.6408"],
|
||||
["5", "LinkedList", "Sorted", "Search", "0.103166"],
|
||||
["5", "LinkedList", "Sorted", "Delete", "0.044656"],
|
||||
|
||||
["5", "HashTable", "Sorted", "Insert", "0.0895"],
|
||||
["5", "HashTable", "Sorted", "Search", "0.000782"],
|
||||
["5", "HashTable", "Sorted", "Delete", "0.000464"],
|
||||
|
||||
["5", "BST", "Sorted", "Insert", "13.9106"],
|
||||
["5", "BST", "Sorted", "Search", "0.113157"],
|
||||
["5", "BST", "Sorted", "Delete", "0.073544"],
|
||||
|
||||
["5", "LinkedList", "Random", "Insert", "9.6219"],
|
||||
["5", "LinkedList", "Random", "Search", "0.058146"],
|
||||
["5", "LinkedList", "Random", "Delete", "0.036343"],
|
||||
|
||||
["5", "HashTable", "Random", "Insert", "0.0876"],
|
||||
["5", "HashTable", "Random", "Search", "0.000840"],
|
||||
["5", "HashTable", "Random", "Delete", "0.000460"],
|
||||
|
||||
["5", "BST", "Random", "Insert", "0.0406"],
|
||||
["5", "BST", "Random", "Search", "0.000352"],
|
||||
["5", "BST", "Random", "Delete", "0.00207"],
|
||||
|
||||
["Average", "LinkedList", "Sorted", "Insert", "8.083650"],
|
||||
["Average", "LinkedList", "Sorted", "Search", "0.071586"],
|
||||
["Average", "LinkedList", "Sorted", "Delete", "0.042504"],
|
||||
|
||||
["Average", "HashTable", "Sorted", "Insert", "0.101125"],
|
||||
["Average", "HashTable", "Sorted", "Search", "0.000974"],
|
||||
["Average", "HashTable", "Sorted", "Delete", "0.000567"],
|
||||
|
||||
["Average", "BST", "Sorted", "Insert", "14.745275"],
|
||||
["Average", "BST", "Sorted", "Search", "0.149163"],
|
||||
["Average", "BST", "Sorted", "Delete", "0.302392"],
|
||||
|
||||
["Average", "LinkedList", "Random", "Insert", "5.302733"],
|
||||
["Average", "LinkedList", "Random", "Search", "0.079588"],
|
||||
["Average", "LinkedList", "Random", "Delete", "0.052027"],
|
||||
|
||||
["Average", "HashTable", "Random", "Insert", "0.121933"],
|
||||
["Average", "HashTable", "Random", "Search", "0.000976"],
|
||||
["Average", "HashTable", "Random", "Delete", "0.000591"],
|
||||
|
||||
["Average", "BST", "Random", "Insert", "0.205333"],
|
||||
["Average", "BST", "Random", "Search", "0.000375"],
|
||||
["Average", "BST", "Random", "Delete", "0.002267"]
|
||||
]
|
||||
with open("results.csv", "w", newline="") as f:
|
||||
writer = csv.writer(f)
|
||||
writer.writerows(results)
|
||||
BIN
romanovpv/task 1/docs/Отчет.docx
Normal file
BIN
romanovpv/task 1/docs/Отчет.docx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user