forked from hofmannol/AlgoDatSoSe25
Made pr07 ready for handing it in
This commit is contained in:
parent
f52faa1822
commit
3fd285a0e8
@ -212,9 +212,12 @@ if __name__ == "__main__":
|
|||||||
# delete first 5 entries and then try to reinsert them
|
# delete first 5 entries and then try to reinsert them
|
||||||
for i in mrange(5):
|
for i in mrange(5):
|
||||||
table.delete(seq0Data[i])
|
table.delete(seq0Data[i])
|
||||||
|
|
||||||
|
assert(table.deletedCount == Literal(5)), "Deleted count should be 5"
|
||||||
for i in mrange(5):
|
for i in mrange(5):
|
||||||
table.insert(seq0Data[i])
|
table.insert(seq0Data[i])
|
||||||
|
|
||||||
|
assert(table.deletedCount == Literal(0)), "Deleted count should be 0 after reinserting"
|
||||||
assert(strFirst == str(table.table[Literal(0)])), "First entry should be the same as before"
|
assert(strFirst == str(table.table[Literal(0)])), "First entry should be the same as before"
|
||||||
print(f"Hashtable after inserting seq0.txt: {table}")
|
print(f"Hashtable after inserting seq0.txt: {table}")
|
||||||
print(f"Load factor after inserting: {table.alpha()}")
|
print(f"Load factor after inserting: {table.alpha()}")
|
||||||
@ -240,7 +243,6 @@ if __name__ == "__main__":
|
|||||||
print(f"Successfully inserted {insertedCount} out of {Literal(len(seq1Data))} values")
|
print(f"Successfully inserted {insertedCount} out of {Literal(len(seq1Data))} values")
|
||||||
print(f"Load factor: {table90.alpha()}")
|
print(f"Load factor: {table90.alpha()}")
|
||||||
|
|
||||||
print("\n--- Task 5 ---")
|
|
||||||
table89 = HashTable(89)
|
table89 = HashTable(89)
|
||||||
|
|
||||||
print(f"Inserting values from seq1.txt into table with 89...")
|
print(f"Inserting values from seq1.txt into table with 89...")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user