From 3fd285a0e863e810b1a364f4f9ac877784e1ea2f Mon Sep 17 00:00:00 2001 From: schoeffelbe82781 Date: Thu, 15 May 2025 22:26:59 +0200 Subject: [PATCH] Made pr07 ready for handing it in --- schoeffelbe/pr07.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/schoeffelbe/pr07.py b/schoeffelbe/pr07.py index 8b43aa0..ca5b671 100644 --- a/schoeffelbe/pr07.py +++ b/schoeffelbe/pr07.py @@ -212,9 +212,12 @@ if __name__ == "__main__": # delete first 5 entries and then try to reinsert them for i in mrange(5): table.delete(seq0Data[i]) + + assert(table.deletedCount == Literal(5)), "Deleted count should be 5" for i in mrange(5): 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" print(f"Hashtable after inserting seq0.txt: {table}") 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"Load factor: {table90.alpha()}") - print("\n--- Task 5 ---") table89 = HashTable(89) print(f"Inserting values from seq1.txt into table with 89...")